• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.14
  • kdeedu
  • marble
  • src
  • apps
  • marble-touch
FileDialog.qml
Go to the documentation of this file.
1 // This file is part of the Marble Virtual Globe.
2 //
3 // This program is free software licensed under the GNU LGPL. You can
4 // find a copy of this license in LICENSE.txt in the top directory of
5 // the source code.
6 //
7 // Copyright 2011 Dennis Nienhüser <earthwings@gentoo.org>
8 
9 import QtQuick 1.0
10 import Qt.labs.folderlistmodel 1.0
11 import com.nokia.meego 1.0
12 
13 Sheet {
14  id: root
15 
16  // Public API
17  property alias filename: filenameField.text
18  property string folder: "/" // Why can't I alias this as well?
19  property alias nameFilters: directoryModel.nameFilters
20  property alias filenameEditable: filenameField.visible
21 
22  acceptButtonText: "Save"
23  rejectButtonText: "Cancel"
24 
25  content: Item {
26  anchors.fill: parent
27 
28  TextField {
29  id: filenameField
30  anchors.left: parent.left
31  anchors.right: parent.right
32  anchors.top: parent.top
33 
34  text: "New file"
35  }
36 
37  Row {
38  id: folderRow
39  height: multiButton.height
40  anchors.top: filenameField.bottom
41  anchors.left: parent.left
42  anchors.right: parent.right
43 
44  MarbleToolIcon {
45  id: multiButton;
46  anchors.verticalCenter: parent.verticalCenter
47  iconSource: main.icon( "actions/go-up", 48 );
48  onClicked: directoryModel.folder = directoryModel.parentFolder
49  }
50  Label {
51  id: folderLabel;
52  anchors.verticalCenter: parent.verticalCenter
53  text: directoryModel.folder
54  }
55  }
56 
57  ListView {
58  id: folderView
59  anchors.left: parent.left
60  anchors.right: parent.right
61  anchors.top: folderRow.bottom
62  anchors.bottom: parent.bottom
63 
64  clip: true
65 
66  highlight: Rectangle { color: "lightsteelblue"; radius: 5 }
67  highlightMoveDuration: 200
68 
69  FolderListModel {
70  id: directoryModel
71  folder: root.folder
72  showOnlyReadable: true
73  }
74 
75  Component {
76  id: fileDelegate
77 
78  Item {
79  id: fileItem
80  property bool isFolder: directoryModel.isFolder(index)
81  width: parent.width
82  height: contentRow.height
83  Row {
84  id: contentRow
85  spacing: 5
86  Image { anchors.verticalCenter: parent.verticalCenter; source: main.icon( fileItem.isFolder ? "places/folder" : "mimetypes/unknown", 48 ) }
87  Label { anchors.verticalCenter: parent.verticalCenter; text: fileName }
88  }
89 
90  MouseArea {
91  anchors.fill: parent
92  onClicked: {
93  folderView.currentIndex = index
94  if (fileItem.isFolder) {
95  directoryModel.folder = directoryModel.folder + "/" + fileName
96  } else {
97  filenameField.text = fileName
98  }
99  }
100  }
101  }
102  }
103 
104  model: directoryModel
105  delegate: fileDelegate
106  }
107  }
108 
109  onAccepted: root.folder = directoryModel.folder
110 }
Rectangle
Marble::radius
static qreal radius(qreal zoom)
Definition: thumbnailer.cpp:99
MarbleWindow::icon
void icon(name, size)
MarbleToolIcon
Definition: harmattan/MarbleToolIcon.qml:10
main
Definition: examples/cpp/marbleQuick2/main.qml:3
TextField
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:39 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal