diff --git a/src/plugins/qmlprojectmanager/buildsystem/qmlbuildsystem.cpp b/src/plugins/qmlprojectmanager/buildsystem/qmlbuildsystem.cpp index 307b6d61451..df52b599aa8 100644 --- a/src/plugins/qmlprojectmanager/buildsystem/qmlbuildsystem.cpp +++ b/src/plugins/qmlprojectmanager/buildsystem/qmlbuildsystem.cpp @@ -81,7 +81,7 @@ QmlBuildSystem::QmlBuildSystem(Target *target) refresh(RefreshOptions::Project); updateDeploymentData(); - registerMenuButtons(); +// registerMenuButtons(); //is wip connect(target->project(), &Project::activeTargetChanged, this, [this](Target *target) { refresh(RefreshOptions::NoFileRefresh); @@ -117,24 +117,29 @@ void QmlBuildSystem::updateDeploymentData() setDeploymentData(deploymentData); } +//probably this method needs to be moved into QmlProjectPlugin::initialize to be called only once void QmlBuildSystem::registerMenuButtons() { Core::ActionContainer *menu = Core::ActionManager::actionContainer(Core::Constants::M_FILE); // QML Project file update button // This button saves the current configuration into the .qmlproject file - auto action = new QAction("Update QmlProject File", this); + auto action = new QAction(Tr::tr("Update QmlProject File"), this); + //this registerAction registers a new action for each opened project, + //causes the "action is already registered" warning if you have multiple opened projects, + //is not a big thing for qds, but is annoying for qtc and should be fixed. Core::Command *cmd = Core::ActionManager::registerAction(action, "QmlProject.ProjectManager"); menu->addAction(cmd, Core::Constants::G_FILE_SAVE); QObject::connect(action, &QAction::triggered, this, &QmlBuildSystem::updateProjectFile); } +//wip: bool QmlBuildSystem::updateProjectFile() { qDebug() << "debug#1-mainfilepath" << mainFilePath(); QFile file(mainFilePath().fileName().append("project-test")); - if (file.open(QIODevice::ReadWrite | QIODevice::Truncate)) { + if (!file.open(QIODevice::ReadWrite | QIODevice::Truncate)) { qCritical() << "Cannot open Qml Project file for editing!"; return false; }