diff --git a/mix/qml/ProjectList.qml b/mix/qml/ProjectList.qml index 138e86fe9..6895de125 100644 --- a/mix/qml/ProjectList.qml +++ b/mix/qml/ProjectList.qml @@ -137,7 +137,12 @@ Item { sectionModel.clear(); } + onProjectClosed: { + sectionModel.clear(); + } + onProjectLoaded: { + sectionModel.clear(); addDocToSubModel(); if (modelData === "Contracts") { diff --git a/mix/qml/ProjectModel.qml b/mix/qml/ProjectModel.qml index 42bf91d9d..10dde5b41 100644 --- a/mix/qml/ProjectModel.qml +++ b/mix/qml/ProjectModel.qml @@ -34,11 +34,9 @@ Item { //interface function saveAll() { ProjectModelCode.saveAll(); } function createProject() { ProjectModelCode.createProject(); } - function browseProject() { ProjectModelCode.browseProject(); } function closeProject() { ProjectModelCode.closeProject(); } function saveProject() { ProjectModelCode.saveProject(); } function loadProject(path) { ProjectModelCode.loadProject(path); } - function addExistingFile() { ProjectModelCode.addExistingFile(); } function newHtmlFile() { ProjectModelCode.newHtmlFile(); } function newJsFile() { ProjectModelCode.newJsFile(); } function newCssFile() { ProjectModelCode.newCssFile(); } @@ -50,6 +48,7 @@ Item { function removeDocument(documentId) { ProjectModelCode.removeDocument(documentId); } function getDocument(documentId) { return ProjectModelCode.getDocument(documentId); } function getDocumentIndex(documentId) { return ProjectModelCode.getDocumentIndex(documentId); } + function doAddExistingFiles(paths) { ProjectModelCode.doAddExistingFiles(paths); } Connections { target: appContext @@ -96,27 +95,4 @@ Item { id: projectSettings property string lastProjectPath; } - - FileDialog { - id: openProjectFileDialog - visible: false - title: qsTr("Open a Project") - selectFolder: true - onAccepted: { - var path = openProjectFileDialog.fileUrl.toString(); - path += "/"; - loadProject(path); - } - } - - FileDialog { - id: addExistingFileDialog - visible: false - title: qsTr("Add a File") - selectFolder: false - onAccepted: { - var paths = addExistingFileDialog.fileUrls; - ProjectModelCode.doAddExistingFiles(paths); - } - } } diff --git a/mix/qml/js/ProjectModel.js b/mix/qml/js/ProjectModel.js index ac44dffa9..7c7a8ae4c 100644 --- a/mix/qml/js/ProjectModel.js +++ b/mix/qml/js/ProjectModel.js @@ -28,10 +28,6 @@ function createProject() { newProjectDialog.open(); } -function browseProject() { - openProjectFileDialog.open(); -} - function closeProject() { if (!isEmpty) { if (haveUnsavedChanges) @@ -77,10 +73,6 @@ function loadProject(path) { projectLoaded() } -function addExistingFile() { - addExistingFileDialog.open(); -} - function addFile(fileName) { var p = projectPath + fileName; var extension = fileName.substring(fileName.lastIndexOf("."), fileName.length); diff --git a/mix/qml/main.qml b/mix/qml/main.qml index ea5d6dd04..79430eb59 100644 --- a/mix/qml/main.qml +++ b/mix/qml/main.qml @@ -203,7 +203,19 @@ ApplicationWindow { text: qsTr("&Open Project") shortcut: "Ctrl+O" enabled: true; - onTriggered: projectModel.browseProject(); + onTriggered: openProjectFileDialog.open() + } + + FileDialog { + id: openProjectFileDialog + visible: false + title: qsTr("Open a Project") + selectFolder: true + onAccepted: { + var path = openProjectFileDialog.fileUrl.toString(); + path += "/"; + projectModel.loadProject(path); + } } Action { @@ -243,7 +255,18 @@ ApplicationWindow { text: qsTr("Add Existing File") shortcut: "Ctrl+Alt+A" enabled: !projectModel.isEmpty - onTriggered: projectModel.addExistingFile(); + onTriggered: addExistingFileDialog.open() + } + + FileDialog { + id: addExistingFileDialog + visible: false + title: qsTr("Add a File") + selectFolder: false + onAccepted: { + var paths = addExistingFileDialog.fileUrls; + projectModel.doAddExistingFiles(paths); + } } Action {