Moved reading xsl file from XslConversion() to TranslationWidget constructor
[mdictionary] / trunk / src / base / gui / TranslationWidget.cpp
index 1bcbf1e..4e0c133 100644 (file)
@@ -46,6 +46,11 @@ TranslationWidget::TranslationWidget(QWidget *parent):
     connect(textEdit, SIGNAL(search()),
            this, SLOT(searchSelected()));
 
+    QFile file(":/xsl/xsl.xsl");
+    if(!file.open(QFile::ReadOnly))
+        qDebug()<<"can't open a xslt file";
+    else
+        xslt=file.readAll();
 }
 
 
@@ -89,14 +94,6 @@ QString TranslationWidget::XslConversion(QString translation)
 {
     QXmlQuery myQuery(QXmlQuery::XSLT20);
     myQuery.setFocus(translation);
-
-    QFile file(":/xsl/xsl.xsl");
-    if(!file.open(QFile::ReadOnly)){
-        qDebug()<<"can't open a xslt file";
-        return translation;
-    }
-    QString xslt;
-    xslt=file.readAll();
     myQuery.setQuery(xslt);
     QString result("");
     myQuery.evaluateTo(&result);