123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341 |
- import QtQuick 1.1
- import com.nokia.symbian 1.1
- import "SymbianUIConstants.js" as Constants
- Page {
- id: fileListPage
-
- property int contentType: Constants.ContentType.Images;
-
- property bool memoryCardPresent: false
-
- property string phoneMemoryFolderToGo
-
- property string memoryCardFolderToGo
- property bool initialized: false;
- tools: ToolBarLayout {
- ToolButton {
- flat: true
- iconSource: "toolbar-back"
- onClicked: {
-
- Qt.quit();
- }
- }
- ButtonRow {
- id: buttonsRow
- TabButton {
- id: imagesButton
- checked: (contentType == Constants.ContentType.Images)
- iconSource: "qrc:/images-icon.png"
- onClicked: {
- var path = fileHelper.phoneMemoryImagesPath;
- phoneMemoryFolderList.goToFolder(fileHelper.pathUrl(path));
- path = fileHelper.memoryCardImagesPath;
- memoryCardFolderList.goToFolder(fileHelper.pathUrl(path));
- contentType = Constants.ContentType.Images;
- }
- }
- TabButton {
- id: soundsButton
- checked: (contentType == Constants.ContentType.Sounds)
- iconSource: "qrc:/sounds-icon.png"
- onClicked: {
- var path = fileHelper.phoneMemorySoundsPath;
- phoneMemoryFolderList.goToFolder(fileHelper.pathUrl(path));
- path = fileHelper.memoryCardSoundsPath;
- memoryCardFolderList.goToFolder(fileHelper.pathUrl(path));
- contentType = Constants.ContentType.Sounds;
- }
- }
- TabButton {
- id: videosButton
- checked: (contentType == Constants.ContentType.Videos)
- iconSource: "qrc:/videos-icon.png"
- onClicked: {
- var path = fileHelper.phoneMemoryVideosPath;
- phoneMemoryFolderList.goToFolder(fileHelper.pathUrl(path));
- path = fileHelper.memoryCardVideosPath;
- memoryCardFolderList.goToFolder(fileHelper.pathUrl(path));
- contentType = Constants.ContentType.Videos;
- }
- }
- }
- }
- Image{
- anchors.fill: parent
- source: "qrc:/background.svg"
- }
- ScrollDecorator {
- flickableItem: flick
- }
-
- Flickable{
- id: flick
- clip: true
- anchors {
- top: parent.top;
- left: parent.left
- right: parent.right
- bottom: parent.bottom
- }
- contentHeight: col.implicitHeight
- Column{
- id: col
- width: parent.width
-
- FolderList {
- id: phoneMemoryFolderList
- width: parent.width
- visible: false
- onFolderSelected: {
- pageStack.push(Qt.resolvedUrl("SubFolderPage.qml"), { folder: folder });
- }
- onFileSelected: {
-
- if (!fileHelper.openUrl(file)) {
- console.debug("FileListPage.qml: " +
- "phoneMemoryFolderList::onFileSelected: Failed to open",
- file);
- }
- }
- function goToFolder(folder)
- {
- phoneMemoryFolderToGo = folder;
- flickableAnimation.restart();
- }
- }
-
- FolderList {
- id: memoryCardFolderList
- width: parent.width
- visible: false
- onFolderSelected: {
- pageStack.push(Qt.resolvedUrl("SubFolderPage.qml"), { folder: folder });
- }
- onFileSelected: {
-
- if (!fileHelper.openUrl(file)) {
- console.debug("FileListPage.qml: " +
- "folderList::onFileSelected: Failed to open",
- file);
- }
- }
- function goToFolder(folder)
- {
- memoryCardFolderToGo = folder;
- flickableAnimation.restart();
- }
- }
-
- Item{
- id: memoryAvailableItem
- width: parent.width
- height: childrenRect.height
- visible: false
- Column{
- width: parent.width
- ListHeading {
- id: listHeading
- width: parent.width
- ListItemText {
- anchors.fill: listHeading.paddingItem
- role: "Heading"
- text: "Memory Available"
- }
- }
-
- ListItem {
- Column {
- anchors.fill: parent.paddingItem
- width: parent.width
- ListItemText {
- role: "Title"
- text: fileHelper.phoneMemoryImagesPath[0] + " (Phone memory)"
- }
- ListItemText {
- role: "SubTitle"
- text: fileHelper.phoneMemoryFreeAndTotalSpace()
- }
- }
- }
-
- ListItem {
- visible: memoryCardPresent
- Column {
- anchors.fill: parent.paddingItem
- width: parent.width
- ListItemText {
- role: "Title"
- text: fileHelper.memoryCardImagesPath[0] + " (Mass memory)"
- }
-
- ListItemText {
- role: "SubTitle"
- text: fileHelper.memoryCardFreeAndTotalSpace()
- }
- }
- }
- }
- }
- }
- }
- Timer{
- id: delayTimer
- interval: 500
- onTriggered: {
- console.log("timer triggered");
- fadeInAnimation.start();
- }
- }
-
- SequentialAnimation {
- id: flickableAnimation
- PropertyAnimation {
- target: flick
- property: "opacity"; to: 0;
- duration: Constants.DEFAULT_ANIM_DURATION
- }
- PropertyAction{
- target: phoneMemoryFolderList
- property: "folder"
- value: phoneMemoryFolderToGo
- }
- PropertyAction{
- target: memoryCardFolderList
- property: "folder"
- value: memoryCardFolderToGo
- }
- PropertyAction{
- targets: phoneMemoryFolderList
- property: "showNoFilesItem"
- value: true
- }
- PropertyAction{
- target: memoryCardFolderList
- property: "showNoFilesItem"
- value: true
- }
- PropertyAction{
- targets: [phoneMemoryFolderList, memoryAvailableItem]
- property: "visible"
- value: true
- }
- PropertyAction{
- targets: memoryCardFolderList
- property: "visible"
- value: memoryCardPresent ? true : false
- }
- onCompleted:{
- console.log("Sequential animation completed");
- delayTimer.start();
- console.log("Memory card present: " + memoryCardPresent);
- }
- }
- PropertyAnimation {
- id: fadeInAnimation
- target: flick
- property: "opacity"; to: 1.0;
- duration: Constants.DEFAULT_ANIM_DURATION
- }
- Component.onCompleted: {
- console.log("Component completed");
-
- var path = fileHelper.pathUrl(fileHelper.phoneMemoryImagesPath);
- phoneMemoryFolderList.goToFolder(path);
- memoryCardPresent = fileHelper.memoryCardPresent
- if(memoryCardPresent){
- path = fileHelper.pathUrl(fileHelper.memoryCardImagesPath);
- memoryCardFolderList.goToFolder(path);
- }
- else
- memoryCardFolderList.visible = false;
- initialized = true;
- }
- onStatusChanged: {
- if(status == PageStatus.Active){
- switch (contentType)
- {
- case Constants.ContentType.Images:
- buttonsRow.checkedButton = imagesButton;;
- break;
- case Constants.ContentType.Sounds:
- buttonsRow.checkedButton = soundsButton;
- break;
- case Constants.ContentType.Videos:
- buttonsRow.checkedButton = videosButton;
- break;
- }
- }
- }
- }
|