diff --git a/limereport/items/lrshapeitem.cpp b/limereport/items/lrshapeitem.cpp index 6bbee9d..e68169d 100644 --- a/limereport/items/lrshapeitem.cpp +++ b/limereport/items/lrshapeitem.cpp @@ -80,7 +80,7 @@ void ShapeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, painter->save(); QPen pen(m_shapeColor); - pen.setWidthF(m_lineWidth); + pen.setWidthF(m_lineWidth+1); pen.setStyle(m_penStyle); pen.setJoinStyle(Qt::MiterJoin); painter->setPen(pen); @@ -89,6 +89,7 @@ void ShapeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, painter->setBrush(brush); painter->setBackground(QBrush(Qt::NoBrush)); painter->setOpacity(qreal(opacity())/100); + QRectF rectangleRect = rect().adjusted((lineWidth() / 2), (lineWidth() / 2), -(lineWidth() / 2), diff --git a/limereport/lrscriptenginemanager.cpp b/limereport/lrscriptenginemanager.cpp index 2abc084..5b70554 100644 --- a/limereport/lrscriptenginemanager.cpp +++ b/limereport/lrscriptenginemanager.cpp @@ -53,8 +53,8 @@ Q_DECLARE_METATYPE(LimeReport::ScriptEngineManager *) #ifdef USE_QTSCRIPTENGINE QScriptValue constructColor(QScriptContext *context, QScriptEngine *engine) { - QColor color(context->argument(0).toString()); - return engine->toScriptValue(color); + QColor color(context->argument(0).toString()); + return engine->toScriptValue(color); } #endif @@ -71,7 +71,7 @@ ScriptEngineNode::~ScriptEngineNode() } ScriptEngineNode*ScriptEngineNode::addChild(const QString& name, const QString& description, - ScriptEngineNode::NodeType type, const QIcon& icon) + ScriptEngineNode::NodeType type, const QIcon& icon) { ScriptEngineNode* res = new ScriptEngineNode(name, description, type,this,icon); m_childs.push_back(res); @@ -218,12 +218,12 @@ ScriptEngineManager::~ScriptEngineManager() bool ScriptEngineManager::isFunctionExists(const QString &functionName) const { return m_functions.contains(functionName); -// foreach (ScriptFunctionDesc desc, m_functions.values()) { -// if (desc.name.compare(functionName,Qt::CaseInsensitive)==0){ -// return true; -// } -// } -// return false; + // foreach (ScriptFunctionDesc desc, m_functions.values()) { + // if (desc.name.compare(functionName,Qt::CaseInsensitive)==0){ + // return true; + // } + // } + // return false; } void ScriptEngineManager::deleteFunction(const QString &functionsName) @@ -244,7 +244,7 @@ bool ScriptEngineManager::addFunction(const JSFunctionDesc &functionDescriber) scriptEngine()->globalObject().setProperty( functionDescriber.managerName(), functionManager - ); + ); } if (functionManager.toQObject() == functionDescriber.manager()){ @@ -275,9 +275,9 @@ bool ScriptEngineManager::addFunction(const JSFunctionDesc &functionDescriber) Q_DECL_DEPRECATED #endif bool ScriptEngineManager::addFunction(const QString& name, - QScriptEngine::FunctionSignature function, - const QString& category, - const QString& description) + QScriptEngine::FunctionSignature function, + const QString& category, + const QString& description) { if (!isFunctionExists(name)){ ScriptFunctionDesc funct; @@ -310,7 +310,7 @@ bool ScriptEngineManager::addFunction(const QString& name, const QString& script funct.description = description; funct.type = ScriptFunctionDesc::Script; m_functions.insert(name, funct); - m_model->updateModel(); + m_model->updateModel(); return true; } else { m_lastError = functionValue.toString(); @@ -321,11 +321,11 @@ bool ScriptEngineManager::addFunction(const QString& name, const QString& script QStringList ScriptEngineManager::functionsNames() { return m_functions.keys(); -// QStringList res; -// foreach(ScriptFunctionDesc func, m_functions){ -// res<groupFunctionNames()){ JSFunctionDesc describer( - func, - tr("GROUP FUNCTIONS"), - func+"(\""+tr("FieldName")+"\",\""+tr("BandName")+"\")", - LimeReport::Const::FUNCTION_MANAGER_NAME, - m_functionManager, - QString("function %1(fieldName, bandName, pageitem){\ - if (typeof pageitem == 'undefined') return %2.calcGroupFunction(\"%1\", fieldName, bandName); \ - else return %2.calcGroupFunction(\"%1\", fieldName, bandName, pageitem);}" - ).arg(func) - .arg(LimeReport::Const::FUNCTION_MANAGER_NAME) - ); - addFunction(describer); + func, + tr("GROUP FUNCTIONS"), + func+"(\""+tr("FieldName")+"\",\""+tr("BandName")+"\")", + LimeReport::Const::FUNCTION_MANAGER_NAME, + m_functionManager, + QString("function %1(fieldName, bandName, pageitem){\ + if (typeof pageitem == 'undefined') return %2.calcGroupFunction(\"%1\", fieldName, bandName); \ + else return %2.calcGroupFunction(\"%1\", fieldName, bandName, pageitem);}" + ).arg(func) + .arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ); + addFunction(describer); } moveQObjectToScript(new DatasourceFunctions(dataManager), LimeReport::Const::DATAFUNCTIONS_MANAGER_NAME); } @@ -368,13 +368,13 @@ QString ScriptEngineManager::expandUserVariables(QString context, RenderPass /* switch (expandType){ case EscapeSymbols: context.replace(rx.cap(0),escapeSimbols(varValue.toString())); - break; + break; case NoEscapeSymbols: context.replace(rx.cap(0),varValue.toString()); - break; + break; case ReplaceHTMLSymbols: context.replace(rx.cap(0),replaceHTMLSymbols(varValue.toString())); - break; + break; } pos=0; @@ -400,53 +400,53 @@ QString ScriptEngineManager::expandUserVariables(QString context, RenderPass /* #else QRegularExpression rx(Const::VARIABLE_RX); if (context.contains(rx)){ - int pos = 0; - QRegularExpressionMatch match = rx.match(context, pos); - while (match.hasMatch()){ + int pos = 0; + QRegularExpressionMatch match = rx.match(context, pos); + while (match.hasMatch()){ - QString variable=match.captured(1); - pos = match.capturedEnd(); + QString variable=match.captured(1); + pos = match.capturedEnd(); - if (dataManager()->containsVariable(variable) ){ - try { + if (dataManager()->containsVariable(variable) ){ + try { - varValue = dataManager()->variable(variable); - switch (expandType){ - case EscapeSymbols: - context.replace(match.captured(0), escapeSimbols(varValue.toString())); - break; - case NoEscapeSymbols: - context.replace(match.captured(0), varValue.toString()); - break; - case ReplaceHTMLSymbols: - context.replace(match.captured(0), replaceHTMLSymbols(varValue.toString())); - break; - } + varValue = dataManager()->variable(variable); + switch (expandType){ + case EscapeSymbols: + context.replace(match.captured(0), escapeSimbols(varValue.toString())); + break; + case NoEscapeSymbols: + context.replace(match.captured(0), varValue.toString()); + break; + case ReplaceHTMLSymbols: + context.replace(match.captured(0), replaceHTMLSymbols(varValue.toString())); + break; + } - pos = 0; + pos = 0; - } catch (ReportError &e){ - dataManager()->putError(e.what()); - if (!dataManager()->reportSettings() || dataManager()->reportSettings()->suppressAbsentFieldsAndVarsWarnings()) - context.replace(match.captured(0), e.what()); - else - context.replace(match.captured(0), ""); - } - } else { + } catch (ReportError &e){ + dataManager()->putError(e.what()); + if (!dataManager()->reportSettings() || dataManager()->reportSettings()->suppressAbsentFieldsAndVarsWarnings()) + context.replace(match.captured(0), e.what()); + else + context.replace(match.captured(0), ""); + } + } else { - QString error; - error = tr("Variable %1 not found").arg(variable); - dataManager()->putError(error); - if (!dataManager()->reportSettings() || dataManager()->reportSettings()->suppressAbsentFieldsAndVarsWarnings()) - context.replace(match.captured(0), error); - else - context.replace(match.captured(0), ""); - } + QString error; + error = tr("Variable %1 not found").arg(variable); + dataManager()->putError(error); + if (!dataManager()->reportSettings() || dataManager()->reportSettings()->suppressAbsentFieldsAndVarsWarnings()) + context.replace(match.captured(0), error); + else + context.replace(match.captured(0), ""); + } - match = rx.match(context, pos); - } - } - return context; + match = rx.match(context, pos); + } + } + return context; #endif } @@ -694,7 +694,12 @@ int ScriptEngineManager::getPageFreeSpace(PageItemDesignIntf* page){ if (page){ int height = 0; foreach(BandDesignIntf* band, page->bands()){ - height += band->height(); + + if(band->type() == BandDesignIntf::Data) + { + height += band->geometry().height() * m_dataManager->dataSource(band->datasourceName())->model()->rowCount(); + } + else height += band->height(); } return page->height() - height; } else return -1; @@ -717,7 +722,7 @@ void ScriptEngineManager::clearTableOfContents(){ } ScriptValueType ScriptEngineManager::moveQObjectToScript(QObject* object, const QString objectName) -{ +{ ScriptValueType obj = scriptEngine()->globalObject().property(objectName); if (!obj.isNull()) delete obj.toQObject(); ScriptValueType result = scriptEngine()->newQObject(object); @@ -762,7 +767,7 @@ bool ScriptEngineManager::createNumberFomatFunction() " if(typeof(precision)==='undefined') precision=2; " " if(typeof(locale)==='undefined') locale=\"\"; " "return %1.numberFormat(value,format,precision,locale);}" - ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) ); return addFunction(fd); } @@ -778,7 +783,7 @@ bool ScriptEngineManager::createDateFormatFunction(){ fd.setScriptWrapper(QString("function dateFormat(value, format, locale){" " if(typeof(format)==='undefined') format = \"dd.MM.yyyy\"; " "return %1.dateFormat(value,format, locale);}" - ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) ); return addFunction(fd); } @@ -794,7 +799,7 @@ bool ScriptEngineManager::createTimeFormatFunction(){ fd.setScriptWrapper(QString("function timeFormat(value, format){" " if(typeof(format)==='undefined') format = \"hh:mm\"; " "return %1.timeFormat(value,format);}" - ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) ); return addFunction(fd); } @@ -810,7 +815,7 @@ bool ScriptEngineManager::createDateTimeFormatFunction(){ fd.setScriptWrapper(QString("function dateTimeFormat(value, format, locale){" " if(typeof(format)==='undefined') format = \"dd.MM.yyyy hh:mm\"; " "return %1.dateTimeFormat(value, format, locale);}" - ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) ); return addFunction(fd); } @@ -827,13 +832,13 @@ bool ScriptEngineManager::createSectotimeFormatFunction() fd.setScriptWrapper(QString("function sectotimeFormat(value, format){" " if(typeof(format)==='undefined') format = \"hh:mm:ss\"; " "return %1.sectotimeFormat(value,format);}" - ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) ); return addFunction(fd); } bool ScriptEngineManager::createDateFunction(){ -// addFunction("date",date,"DATE&TIME","date()"); + // addFunction("date",date,"DATE&TIME","date()"); JSFunctionDesc fd; fd.setManager(m_functionManager); @@ -843,14 +848,14 @@ bool ScriptEngineManager::createDateFunction(){ fd.setDescription("date()"); fd.setScriptWrapper(QString("function date(){" "return %1.date();}" - ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) ); return addFunction(fd); } bool ScriptEngineManager::createNowFunction(){ -// addFunction("now",now,"DATE&TIME","now()"); + // addFunction("now",now,"DATE&TIME","now()"); JSFunctionDesc fd; fd.setManager(m_functionManager); @@ -860,13 +865,13 @@ bool ScriptEngineManager::createNowFunction(){ fd.setDescription("now()"); fd.setScriptWrapper(QString("function now(){" "return %1.now();}" - ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) ); return addFunction(fd); } bool ScriptEngineManager::createCurrencyFormatFunction(){ -// addFunction("currencyFormat",currencyFormat,"NUMBER","currencyFormat(\""+tr("Value")+"\",\""+tr("Locale")+"\")"); + // addFunction("currencyFormat",currencyFormat,"NUMBER","currencyFormat(\""+tr("Value")+"\",\""+tr("Locale")+"\")"); JSFunctionDesc fd; fd.setManager(m_functionManager); @@ -877,13 +882,13 @@ bool ScriptEngineManager::createCurrencyFormatFunction(){ fd.setScriptWrapper(QString("function currencyFormat(value, locale){" " if(typeof(locale)==='undefined') locale = \"\"; " "return %1.currencyFormat(value,locale);}" - ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) ); return addFunction(fd); } bool ScriptEngineManager::createCurrencyUSBasedFormatFunction(){ -// addFunction("currencyUSBasedFormat",currencyUSBasedFormat,"NUMBER","currencyUSBasedFormat(\""+tr("Value")+",\""+tr("CurrencySymbol")+"\")"); + // addFunction("currencyUSBasedFormat",currencyUSBasedFormat,"NUMBER","currencyUSBasedFormat(\""+tr("Value")+",\""+tr("CurrencySymbol")+"\")"); JSFunctionDesc fd; fd.setManager(m_functionManager); @@ -894,13 +899,13 @@ bool ScriptEngineManager::createCurrencyUSBasedFormatFunction(){ fd.setScriptWrapper(QString("function currencyUSBasedFormat(value, currencySymbol){" " if(typeof(currencySymbol)==='undefined') currencySymbol = \"\"; " "return %1.currencyUSBasedFormat(value,currencySymbol);}" - ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) ); return addFunction(fd); } bool ScriptEngineManager::createSetVariableFunction(){ -// addFunction("setVariable", setVariable, "GENERAL", "setVariable(\""+tr("Name")+"\",\""+tr("Value")+"\")"); + // addFunction("setVariable", setVariable, "GENERAL", "setVariable(\""+tr("Name")+"\",\""+tr("Value")+"\")"); JSFunctionDesc fd; fd.setManager(m_functionManager); @@ -910,7 +915,7 @@ bool ScriptEngineManager::createSetVariableFunction(){ fd.setDescription("setVariable(\""+tr("Name")+"\",\""+tr("Value")+"\")"); fd.setScriptWrapper(QString("function setVariable(name, value){" "return %1.setVariable(name,value);}" - ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) ); return addFunction(fd); } @@ -925,7 +930,7 @@ bool ScriptEngineManager::createGetVariableFunction() fd.setDescription("getVariable(\""+tr("Name")+"\")"); fd.setScriptWrapper(QString("function getVariable(name){" "return %1.getVariable(name);}" - ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) ); return addFunction(fd); } @@ -940,7 +945,7 @@ bool ScriptEngineManager::createGetFieldFunction() fd.setDescription("getField(\""+tr("Name")+"\")"); fd.setScriptWrapper(QString("function getField(name){" "return %1.getField(name);}" - ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) ); return addFunction(fd); } @@ -956,10 +961,10 @@ bool ScriptEngineManager::createGetFieldByKeyFunction() tr("ValueField")+"\",\""+ tr("KeyField")+"\", \""+ tr("KeyFieldValue")+"\")" - ); + ); fd.setScriptWrapper(QString("function getFieldByKeyField(datasource, valueFieldName, keyFieldName, keyValue){" "return %1.getFieldByKeyField(datasource, valueFieldName, keyFieldName, keyValue);}" - ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) ); return addFunction(fd); } @@ -973,10 +978,10 @@ bool ScriptEngineManager::createGetFieldByRowIndex() fd.setName("getFieldByRowIndex"); fd.setDescription("getFieldByRowIndex(\""+tr("FieldName")+"\", \""+ tr("RowIndex")+"\")" - ); + ); fd.setScriptWrapper(QString("function getFieldByRowIndex(fieldName, rowIndex){" "return %1.getFieldByRowIndex(fieldName, rowIndex);}" - ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) ); return addFunction(fd); } @@ -991,7 +996,7 @@ bool ScriptEngineManager::createAddBookmarkFunction() fd.setDescription("addBookmark(\""+tr("Unique identifier")+" \""+tr("Content")+"\")"); fd.setScriptWrapper(QString("function addBookmark(uniqKey, content){" "return %1.addBookmark(uniqKey, content);}" - ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) ); return addFunction(fd); } @@ -1006,7 +1011,7 @@ bool ScriptEngineManager::createFindPageIndexByBookmark() fd.setDescription("findPageIndexByBookmark(\""+tr("Unique identifier")+"\")"); fd.setScriptWrapper(QString("function findPageIndexByBookmark(uniqKey){" "return %1.findPageIndexByBookmark(uniqKey);}" - ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) ); return addFunction(fd); } @@ -1021,7 +1026,7 @@ bool ScriptEngineManager::createAddTableOfContentsItemFunction() fd.setDescription("addTableOfContentsItem(\""+tr("Unique identifier")+" \""+tr("Content")+"\", \""+tr("Indent")+"\")"); fd.setScriptWrapper(QString("function addTableOfContentsItem(uniqKey, content, indent){" "return %1.addTableOfContentsItem(uniqKey, content, indent);}" - ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) ); return addFunction(fd); } @@ -1036,7 +1041,7 @@ bool ScriptEngineManager::createClearTableOfContentsFunction() fd.setDescription("clearTableOfContents()"); fd.setScriptWrapper(QString("function clearTableOfContents(){" "return %1.clearTableOfContents();}" - ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) ); return addFunction(fd); } @@ -1051,7 +1056,7 @@ bool ScriptEngineManager::createReopenDatasourceFunction() fd.setDescription("reopenDatasource(\""+tr("datasourceName")+"\")"); fd.setScriptWrapper(QString("function reopenDatasource(datasourceName){" "return %1.reopenDatasource(datasourceName);}" - ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) ); return addFunction(fd); } @@ -1064,7 +1069,7 @@ ScriptEngineManager::ScriptEngineManager() m_functionManager->setScriptEngineManager(this); #ifdef USE_QTSCRIPTENGINE m_scriptEngine->setDefaultPrototype(qMetaTypeId(), - m_scriptEngine->newQObject(new ComboBoxPrototype())); + m_scriptEngine->newQObject(new ComboBoxPrototype())); #endif createLineFunction(); createNumberFomatFunction(); @@ -1117,7 +1122,7 @@ bool ScriptExtractor::parse(int &curPos, const State& state, ScriptNode::Ptr scr return true; } else { if (m_context[curPos]=='{') - extractBracket(curPos, scriptNode); + extractBracket(curPos, scriptNode); } case None: if (m_context[curPos]=='$'){ @@ -1522,16 +1527,16 @@ void ScriptEngineContext::qobjectToScript(const QString& name, QObject *item) { ScriptEngineType* engine = ScriptEngineManager::instance().scriptEngine(); #ifdef USE_QJSENGINE - ScriptValueType sItem = getJSValue(*engine, item); - engine->globalObject().setProperty(name, sItem); + ScriptValueType sItem = getJSValue(*engine, item); + engine->globalObject().setProperty(name, sItem); #else - ScriptValueType sItem = engine->globalObject().property(name); - if (sItem.isValid()){ - engine->newQObject(sItem, item); - } else { - sItem = engine->newQObject(item); - engine->globalObject().setProperty(name,sItem); - } + ScriptValueType sItem = engine->globalObject().property(name); + if (sItem.isValid()){ + engine->newQObject(sItem, item); + } else { + sItem = engine->newQObject(item); + engine->globalObject().setProperty(name,sItem); + } #endif } @@ -1574,17 +1579,17 @@ bool ScriptEngineContext::runInitScript(){ #ifdef USE_QJSENGINE if (res.isError()){ QMessageBox::critical(0,tr("Error"), - QString("Line %1: %2 ").arg(res.property("lineNumber").toString()) - .arg(res.toString()) - ); + QString("Line %1: %2 ").arg(res.property("lineNumber").toString()) + .arg(res.toString()) + ); return false; } #else if (engine->hasUncaughtException()) { QMessageBox::critical(0,tr("Error"), - QString("Line %1: %2 ").arg(engine->uncaughtExceptionLineNumber()) - .arg(engine->uncaughtException().toString()) - ); + QString("Line %1: %2 ").arg(engine->uncaughtExceptionLineNumber()) + .arg(engine->uncaughtException().toString()) + ); return false; } #endif @@ -1987,28 +1992,28 @@ void TableOfContents::slotOneSlotDS(CallbackInfo info, QVariant& data) columns << "Content" << "Page number" << "Content Key"; switch (info.dataType) { - case LimeReport::CallbackInfo::RowCount: - data = m_tableOfContents.count(); - break; - case LimeReport::CallbackInfo::ColumnCount: - data = columns.size(); - break; - case LimeReport::CallbackInfo::ColumnHeaderData: { - data = columns.at(info.index); - break; + case LimeReport::CallbackInfo::RowCount: + data = m_tableOfContents.count(); + break; + case LimeReport::CallbackInfo::ColumnCount: + data = columns.size(); + break; + case LimeReport::CallbackInfo::ColumnHeaderData: { + data = columns.at(info.index); + break; + } + case LimeReport::CallbackInfo::ColumnData: + if (info.index < m_tableOfContents.count()){ + ContentItem* item = m_tableOfContents.at(info.index); + if (info.columnName.compare("Content",Qt::CaseInsensitive) == 0) + data = item->content.rightJustified(item->indent+item->content.size()); + if (info.columnName.compare("Content Key",Qt::CaseInsensitive) == 0) + data = item->uniqKey; + if (info.columnName.compare("Page number",Qt::CaseInsensitive) == 0) + data = QString::number(item->pageNumber); } - case LimeReport::CallbackInfo::ColumnData: - if (info.index < m_tableOfContents.count()){ - ContentItem* item = m_tableOfContents.at(info.index); - if (info.columnName.compare("Content",Qt::CaseInsensitive) == 0) - data = item->content.rightJustified(item->indent+item->content.size()); - if (info.columnName.compare("Content Key",Qt::CaseInsensitive) == 0) - data = item->uniqKey; - if (info.columnName.compare("Page number",Qt::CaseInsensitive) == 0) - data = QString::number(item->pageNumber); - } - break; - default: break; + break; + default: break; } } @@ -2060,6 +2065,13 @@ bool DatasourceFunctions::isEOF(const QString &datasourceName) return true; } +int DatasourceFunctions::rowCount(const QString &datasourceName) +{ + if (m_dataManager && m_dataManager->dataSource(datasourceName)) + return m_dataManager->dataSource(datasourceName)->model()->rowCount(); + return 0; +} + bool DatasourceFunctions::invalidate(const QString& datasourceName) { if (m_dataManager && m_dataManager->dataSource(datasourceName)){ diff --git a/limereport/lrscriptenginemanager.h b/limereport/lrscriptenginemanager.h index 7c3bccd..dc75bc5 100644 --- a/limereport/lrscriptenginemanager.h +++ b/limereport/lrscriptenginemanager.h @@ -209,7 +209,7 @@ public: bool hasChanges(){ return m_hasChanges;} ReportPages* reportPages() const; void setReportPages(ReportPages* value); -#ifdef HAVE_UI_LOADER +#ifdef HAVE_UI_LOADER signals: void dialogNameChanged(QString dialogName); void dialogDeleted(QString dialogName); @@ -337,6 +337,7 @@ public: Q_INVOKABLE bool next(const QString& datasourceName); Q_INVOKABLE bool prior(const QString& datasourceName); Q_INVOKABLE bool isEOF(const QString& datasourceName); + Q_INVOKABLE int rowCount(const QString& datasourceName); Q_INVOKABLE bool invalidate(const QString& datasourceName); Q_INVOKABLE QObject *createTableBuilder(QObject *horizontalLayout); private: @@ -441,7 +442,7 @@ private: }; class ScriptEngineManager : public QObject, public Singleton, public IScriptEngineManager -{ +{ Q_OBJECT public: friend class Singleton; diff --git a/translations/limereport_fr.ts b/translations/limereport_fr.ts index 9648930..7b4a799 100644 --- a/translations/limereport_fr.ts +++ b/translations/limereport_fr.ts @@ -3422,13 +3422,13 @@ Cet aperçu n'est plus valide. LimeReport::ScriptEngineContext - + Dialog with name: %1 can`t be created Le dialogue avec le nom "%1" ne peut pas être crée - - + + Error Erreur @@ -3441,20 +3441,20 @@ Cet aperçu n'est plus valide. Fonctions de groupe - - - - - - - - + + + + + + + + Value Valeur - + BandName Nom de la bande @@ -3465,7 +3465,7 @@ Cet aperçu n'est plus valide. - + FieldName Nom du champ @@ -3482,120 +3482,120 @@ Cet aperçu n'est plus valide. Champ "%1 introuvable dans %2! - + SYSTEM Système - - - + + + NUMBER Nombre - - - - - + + + + + Format - + Precision Précision - - - - + + + + Locale Local - - - - - - + + + + + + DATE&TIME Date&Heure - + CurrencySymbol Symbolde de la monnaie - - - - - - - - - - + + + + + + + + + + GENERAL General - - - + + + Name Nom - + Datasource Source de donnée - + ValueField Valeur - + KeyField Clé - + KeyFieldValue Valeur de la clé - + RowIndex - - - + + + Unique identifier Identifiant unique - - + + Content Contenu - + Indent Indenter - + datasourceName Nom de source de donnée @@ -4202,12 +4202,12 @@ Cet aperçu n'est plus valide. L'objet avec le nom "%1" existe déja! - + Function %1 not found or have wrong arguments La fonction %1 est introuvable ou contient des paramètres incorrects - + Datasource manager not found Gestionnaire de source de donnée introuvable diff --git a/translations/limereport_pl.ts b/translations/limereport_pl.ts index 50f570a..f3d44c9 100644 --- a/translations/limereport_pl.ts +++ b/translations/limereport_pl.ts @@ -3434,13 +3434,13 @@ Ten podgląd nie jest już prawidłowy. LimeReport::ScriptEngineContext - + Dialog with name: %1 can`t be created Okno dialogowe z nazwą:%1 nie można utworzyć - - + + Error Błąd @@ -3453,20 +3453,20 @@ Ten podgląd nie jest już prawidłowy. FUNKCJE GRUPUJĄCE - - - - - - - - + + + + + + + + Value Wartość - + BandName Nazwa sekcji @@ -3477,7 +3477,7 @@ Ten podgląd nie jest już prawidłowy. - + FieldName Nazwa pola @@ -3494,120 +3494,120 @@ Ten podgląd nie jest już prawidłowy. Pole %1 nie znalezione w %2! - + SYSTEM SYSTEM - - - + + + NUMBER LICZBA - - - - - + + + + + Format Format - + Precision Precyzja - - - - + + + + Locale Ustawienia lokalne - - - - - - + + + + + + DATE&TIME Data i czas - + Datasource Źródło danych - + ValueField Pole wartości - + KeyField Pole klucza - + KeyFieldValue Wartość pola klucza - + RowIndex Indeks wiersza - - - + + + Unique identifier Unikalny identyfikator - - + + Content Zawartość - + Indent Akapit - + datasourceName Nazwa źródła danych - + CurrencySymbol Symbol waluty - - - - - - - - - - + + + + + + + + + + GENERAL OGÓLNY - - - + + + Name Nazwa @@ -4214,12 +4214,12 @@ Ten podgląd nie jest już prawidłowy. Obiekt o nazwie %1 już istnieje! - + Function %1 not found or have wrong arguments Funkcja %1 nie znaleziona lub ma błędne argumenty - + Datasource manager not found Nie znaleziono menedżera źródła danych