28#include <QRegularExpression>
32#include "ProjectItemModel.h"
34#include "TemplateList.h"
48 QAction::setText(tr(
"Import Registration Templates..."));
49 QUndoCommand::setText(tr(
"Import Registration Templates..."));
94 QString itemType = item->text();
97 return (itemType ==
"Registrations");
116 templateFileNames = QFileDialog::getOpenFileNames(
117 qobject_cast<QWidget *>(parent()),
118 "Import Registration Templates",
120 "Registrations (*.def);; All Files (*)");
122 if (!templateFileNames.isEmpty()) {
123 QUndoCommand::setText(tr(
"Import %1 Template(s)").arg(templateFileNames.count()));
147 "registrations/" + templateFolder.dirName() );
149 foreach (
FileName filename, templateFileNames) {
150 QFile::copy(filename.
expanded(), templateFolder.path() +
"/" + filename.
name());
151 m_list->append(
new Template(templateFolder.path() +
"/" + filename.
name(),
153 templateFolder.dirName()));
156 if (!m_list->isEmpty()) {
171 if (m_list &&
project()->templates().size() > 0) {
177 foreach (
Template *currentTemplate, *m_list) {
178 delete currentTemplate;
ProjectItemModel * model()
Gets the ProjectItemModel for this directory.
File name manipulation and expansion.
QString name() const
Returns the name of the file excluding the path and the attributes in the file name.
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
Add registration templates to a project.
virtual bool isExecutable(ProjectItem *item)
This method returns true if the user clicked on a project tree node with the text "Registrations".
virtual ImportRegistrationTemplateWorkOrder * clone() const
This method clones the current ImportRegistrationTemplateWorkOrder and returns it.
ImportRegistrationTemplateWorkOrder(Project *project)
Creates a work order to import registration templates.
~ImportRegistrationTemplateWorkOrder()
Destructor.
void undoExecution()
Deletes the previously imported templates.
void execute()
Imports the templates.
bool setupExecution()
Sets up the work order for execution.
The main project for ipce.
QDir addTemplateFolder(QString prefix)
Create and navigate to the appropriate template type folder in the project directory.
Directory * directory() const
Returns the directory associated with this Project.
void setClean(bool value)
Function to change the clean state of the project.
void addTemplates(TemplateList *templateFiles)
Add new templates to m_mapTemplates or m_regTemplates and update project item model.
Represents an item of a ProjectItemModel in Qt's model-view framework.
ProjectItem * findItemData(const QVariant &data, int role=Qt::UserRole+1)
Returns the first item found that contains the given data in the given role or a null pointer if no i...
virtual void removeItem(ProjectItem *item)
Removes an item and its children from the model.
void deleteFromDisk(Project *project)
Delete all of the contained Templates from disk.
Provide Undo/redo abilities, serialization, and history for an operation.
bool m_isUndoable
Set the workorder to be undoable/redoable This is defaulted to true - his will allow the workorder to...
virtual bool setupExecution()
This sets up the state for the work order.
QStringList internalData() const
Gets the internal data for this WorkOrder.
void setModifiesDiskState(bool changesProjectOnDisk)
void setInternalData(QStringList data)
Sets the internal data for this WorkOrder.
Project * project() const
Returns the Project this WorkOrder is attached to.
This is free and unencumbered software released into the public domain.