Browse Source

Merge pull request #998 from yann300/bug_fix

bug fix - mix: Menu item "Open Project" doesn't do anything #995
cl-refactor
Arkadiy Paronyan 10 years ago
parent
commit
7af4cc6d2c
  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(); sectionModel.clear();
} }
onProjectClosed: {
sectionModel.clear();
}
onProjectLoaded: { onProjectLoaded: {
sectionModel.clear();
addDocToSubModel(); addDocToSubModel();
if (modelData === "Contracts") if (modelData === "Contracts")
{ {

26
mix/qml/ProjectModel.qml

@ -34,11 +34,9 @@ Item {
//interface //interface
function saveAll() { ProjectModelCode.saveAll(); } function saveAll() { ProjectModelCode.saveAll(); }
function createProject() { ProjectModelCode.createProject(); } function createProject() { ProjectModelCode.createProject(); }
function browseProject() { ProjectModelCode.browseProject(); }
function closeProject() { ProjectModelCode.closeProject(); } function closeProject() { ProjectModelCode.closeProject(); }
function saveProject() { ProjectModelCode.saveProject(); } function saveProject() { ProjectModelCode.saveProject(); }
function loadProject(path) { ProjectModelCode.loadProject(path); } function loadProject(path) { ProjectModelCode.loadProject(path); }
function addExistingFile() { ProjectModelCode.addExistingFile(); }
function newHtmlFile() { ProjectModelCode.newHtmlFile(); } function newHtmlFile() { ProjectModelCode.newHtmlFile(); }
function newJsFile() { ProjectModelCode.newJsFile(); } function newJsFile() { ProjectModelCode.newJsFile(); }
function newCssFile() { ProjectModelCode.newCssFile(); } function newCssFile() { ProjectModelCode.newCssFile(); }
@ -50,6 +48,7 @@ Item {
function removeDocument(documentId) { ProjectModelCode.removeDocument(documentId); } function removeDocument(documentId) { ProjectModelCode.removeDocument(documentId); }
function getDocument(documentId) { return ProjectModelCode.getDocument(documentId); } function getDocument(documentId) { return ProjectModelCode.getDocument(documentId); }
function getDocumentIndex(documentId) { return ProjectModelCode.getDocumentIndex(documentId); } function getDocumentIndex(documentId) { return ProjectModelCode.getDocumentIndex(documentId); }
function doAddExistingFiles(paths) { ProjectModelCode.doAddExistingFiles(paths); }
Connections { Connections {
target: appContext target: appContext
@ -96,27 +95,4 @@ Item {
id: projectSettings id: projectSettings
property string lastProjectPath; 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(); newProjectDialog.open();
} }
function browseProject() {
openProjectFileDialog.open();
}
function closeProject() { function closeProject() {
if (!isEmpty) { if (!isEmpty) {
if (haveUnsavedChanges) if (haveUnsavedChanges)
@ -77,10 +73,6 @@ function loadProject(path) {
projectLoaded() projectLoaded()
} }
function addExistingFile() {
addExistingFileDialog.open();
}
function addFile(fileName) { function addFile(fileName) {
var p = projectPath + fileName; var p = projectPath + fileName;
var extension = fileName.substring(fileName.lastIndexOf("."), fileName.length); var extension = fileName.substring(fileName.lastIndexOf("."), fileName.length);

27
mix/qml/main.qml

@ -203,7 +203,19 @@ ApplicationWindow {
text: qsTr("&Open Project") text: qsTr("&Open Project")
shortcut: "Ctrl+O" shortcut: "Ctrl+O"
enabled: true; 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 { Action {
@ -243,7 +255,18 @@ ApplicationWindow {
text: qsTr("Add Existing File") text: qsTr("Add Existing File")
shortcut: "Ctrl+Alt+A" shortcut: "Ctrl+Alt+A"
enabled: !projectModel.isEmpty 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 { Action {

Loading…
Cancel
Save