Exemplo n.º 1
0
bool ItemsList::generateSchedule()
{
    if (!m_actualTable.isEmpty() && mainOrderActive )
    {
        setAnimationVisible(true);
        emit animationVisible(getAnimationVisible());

        if( setPath().isEmpty() ) {
            runMsg("Nie wybrano lokalizacji.");
            setAnimationVisible(false);
            emit animationVisible(getAnimationVisible());
            return false;
        }

        QAxObject* excel;
        QAxObject* wbooks;
        QAxObject* book;
        QFileInfo scheduleFile("schedule.xlsm");
        QVariant excelPath;
        QVariant destPath;

        excelPath = QVariant(scheduleFile.absoluteFilePath().replace("/", "\\\\"));

        excel = new QAxObject("Excel.Application", this);
        excel->setProperty("Visible", false);
        excel->setProperty("DisplayAlerts",0);

        wbooks = excel->querySubObject("Workbooks");
        book = wbooks->querySubObject("Open (const QString&)", excelPath);
        destPath = excel->dynamicCall("Run(QVariant)", QVariant("runMacro"));

        book->dynamicCall("Close()");
        excel->dynamicCall("Quit()");

        runMsg("Wygenerowano harmonogram",destPath.toString());
        delete book;
        delete wbooks;
        delete excel;

        setAnimationVisible(false);
        emit animationVisible(getAnimationVisible());

        csvFile->remove();
        tableDialog->model->clear();
        mainOrderActive = false;
        return true;
     }
     else if(m_actualTable.isEmpty() || !mainOrderActive )
     {
        runMsg("Zamówienie jest puste.");
        return false;
    }

    return false;

}
Exemplo n.º 2
0
void AnimationRect::show() {
	visible = true;
	emit animationVisible();
}