Пример #1
0
void View::Management::EntityEditor::delEntity()
{
    if(!verifyDelete())
        return;

    int row = _entitiesTableView -> currentIndex().row();
    Model::Management::EntityManager::remove((_entityModel -> entities() -> at(row)) -> id(), _type);
    _entityModel -> removeEntity(row);
    rowSelectionChanged();
}
Пример #2
0
void View::Invoicing::OperationEditor::createConnections()
{
    connect(_operationsTable -> selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
            this, SLOT(rowSelectionChanged()));
    connect(_operationsTable, SIGNAL(productNotFound()),
            this, SLOT(productNotFound()));
    connect(_operationModel, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)),
            this, SIGNAL(dataChanged()));
    connect(_addOperationButton, SIGNAL(clicked()),
            this, SLOT(addOperation()));
    connect(_modOperationButton, SIGNAL(clicked()),
            this, SLOT(modOperation()));
    connect(_delOperationButton, SIGNAL(clicked()),
            this, SLOT(delOperation()));
}
Пример #3
0
void View::Management::EntityEditor::defEntity()
{
    int row = _entitiesTableView -> currentIndex().row();
    Model::Domain::Entity *entity = _entityModel -> entities() -> at(row);
    QString currDefaultCompany = Persistence::Manager::readConfig("DefaultCompany").toString();

    if(currDefaultCompany == entity -> name())
        Persistence::Manager::writeConfig("", "DefaultCompany");
    else
        Persistence::Manager::writeConfig(entity -> name(), "DefaultCompany");

    _entityModel -> defaultEntity(row);

    rowSelectionChanged();
}
Пример #4
0
void View::Management::EntityEditor::modEntity()
{
    int row = _entitiesTableView -> currentIndex().row();
    Model::Domain::Entity *entity = _entityModel -> entities() -> at(row);
    EntityDialog dialog(entity, this);

    if(dialog.exec()) {
        if(((_type == Model::Domain::CompanyEntity) ?
             Model::Management::CompanyManager::modify(*entity) :
             Model::Management::EntityManager::modify(*entity)))
            _entityModel -> modifyEntity(row);
        else
            QMessageBox::critical(this, tr("Critical Error"),
                                  tr("Error during the entity modification"),
                                  QMessageBox::Ok);

        rowSelectionChanged();
    }
}
Пример #5
0
void View::Management::EntityEditor::createConnections()
{
    connect(_allRadioButton, SIGNAL(toggled(bool)),
            this, SLOT(toggleOnRadioButton()));
    connect(_filterByRadioButton, SIGNAL(toggled(bool)),
            this, SLOT(toggleOnRadioButton()));
    connect(_comboBox, SIGNAL(currentIndexChanged(QString)),
            this, SLOT(currentIndexChangedOnComboBox()));
    connect(_lineEdit, SIGNAL(textChanged(QString)),
            this, SLOT(textChangedOnLineEdit(QString)));
    connect(_entitiesTableView -> selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
            this, SLOT(rowSelectionChanged()));
    connect(_entitiesTableView, SIGNAL(doubleClicked(QModelIndex)),
            this, SLOT(modEntity()));
    connect(_defaultButton, SIGNAL(clicked()),
            this, SLOT(defEntity()));
    connect(_addEntityButton, SIGNAL(clicked()),
            this, SLOT(addEntity()));
    connect(_modEntityButton, SIGNAL(clicked()),
            this, SLOT(modEntity()));
    connect(_delEntityButton, SIGNAL(clicked()),
            this, SLOT(delEntity()));
}
Пример #6
0
void View::Management::EntityEditor::addEntity()
{
    Model::Domain::Entity *entity = (_type == Model::Domain::CompanyEntity ?
                                         new Model::Domain::Company :
                                         new Model::Domain::Entity(_type));
    EntityDialog dialog(entity, this);

    if(dialog.exec()) {
        if(((_type == Model::Domain::CompanyEntity) ?
             Model::Management::CompanyManager::create(*entity) :
             Model::Management::EntityManager::create(*entity))) {
            int row = _entityModel -> rowCount(QModelIndex());
            _entityModel -> insertEntity(row, entity);
        } else {
            QMessageBox::critical(this, tr("Critical Error"),
                                  tr("Error during the entity addition"),
                                  QMessageBox::Ok);
            delete entity;
        }

        rowSelectionChanged();
    } else
        delete entity;
}