Browse Source

bug fix #995

mix: Menu item "Open Project" doesn't do anything #995
cl-refactor
yann300 10 years ago
committed by yann300
parent
commit
2ad606baeb
  1. 5
      mix/qml/ProjectList.qml
  2. 26
      mix/qml/ProjectModel.qml
  3. 8
      mix/qml/js/ProjectModel.js
  4. 27
      mix/qml/main.qml

5
mix/qml/ProjectList.qml

@ -137,7 +137,12 @@ Item {
sectionModel.clear();
}
onProjectClosed: {
sectionModel.clear();
}
onProjectLoaded: {
sectionModel.clear();
addDocToSubModel();
if (modelData === "Contracts")
{

26
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);
}
}
}

8
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);

27
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 {

Loading…
Cancel
Save