diff --git a/limereport/lrpagedesignintf.cpp b/limereport/lrpagedesignintf.cpp index 7829e1f..dfda279 100644 --- a/limereport/lrpagedesignintf.cpp +++ b/limereport/lrpagedesignintf.cpp @@ -1214,24 +1214,12 @@ BaseDesignIntf* PageDesignIntf::findDestObject(BaseDesignIntf* item){ void PageDesignIntf::paste() { QClipboard *clipboard = QApplication::clipboard(); - if (!selectedItems().isEmpty()) { BaseDesignIntf* destItem = findDestObject(dynamic_cast(selectedItems().at(0))); if (destItem){ CommandIf::Ptr command = PasteCommand::create(this, clipboard->text(), destItem); saveCommand(command); } -// BandDesignIntf *band = dynamic_cast(selectedItems().at(0)); -// if (band) { -// CommandIf::Ptr command = PasteCommand::create(this, clipboard->text(), band); -// saveCommand(command); -// } else { -// PageItemDesignIntf* page = dynamic_cast(selectedItems().at(0)); -// if (page){ -// CommandIf::Ptr command = PasteCommand::create(this, clipboard->text(), page); -// saveCommand(command); -// } else {} -// } } } diff --git a/limereport/lrscriptenginemanager.cpp b/limereport/lrscriptenginemanager.cpp index 6bc7a34..5bdfdd7 100644 --- a/limereport/lrscriptenginemanager.cpp +++ b/limereport/lrscriptenginemanager.cpp @@ -213,6 +213,12 @@ QScriptValue numberFormat(QScriptContext* pcontext, QScriptEngine* pengine){ return res; } +QScriptValue currencyFormat(QScriptContext* pcontext, QScriptEngine* pengine){ + QVariant value = pcontext->argument(0).toVariant(); + QString locale = (pcontext->argumentCount()>1)?pcontext->argument(1).toString():QLocale::system().name(); + return pengine->newVariant(QLocale(locale).toCurrencyString(value.toDouble())); +} + QScriptValue dateFormat(QScriptContext* pcontext, QScriptEngine* pengine){ QVariant value = pcontext->argument(0).toVariant(); QString format = (pcontext->argumentCount()>1)?pcontext->argument(1).toString().toLatin1():"dd.MM.yyyy"; @@ -374,6 +380,7 @@ ScriptEngineManager::ScriptEngineManager() addFunction("dateTimeFormat", dateTimeFormat, "DATE&TIME", "dateTimeFormat(\""+tr("Value")+"\",\""+tr("Format")+"\")"); addFunction("date",date,"DATE&TIME","date()"); addFunction("now",now,"DATE&TIME","now()"); + addFunction("currencyFormat",currencyFormat,"NUMBER","currencyFormat(\""+tr("Value")+",\""+tr("Locale")+"\")"); QScriptValue colorCtor = m_scriptEngine->newFunction(constructColor); m_scriptEngine->globalObject().setProperty("QColor", colorCtor);