From e20a92864ee65ecd4306d8519c8582bb39cb4de3 Mon Sep 17 00:00:00 2001 From: Konrad Rosenbaum Date: Sun, 11 Mar 2012 01:41:57 +0100 Subject: [PATCH] finish ODF edit: template test --- src/dialogs/eventsummary.cpp | 19 +++++- src/dialogs/eventsummary.h | 4 + src/dialogs/orderwin.cpp | 17 +++++- src/dialogs/orderwin.h | 4 + src/mwin/carttab.cpp | 31 +-------- src/mwin/carttab.h | 6 +- src/mwin/eventstab.cpp | 47 ++++++++++++++ src/mwin/eventstab.h | 11 +++- src/mwin/orderstab.cpp | 36 +--------- src/mwin/orderstab.h | 2 +- src/mwin/overview.cpp | 5 +- src/templates/odfedit.cpp | 144 +++++++++++++++++++++++++++++++++++++++--- src/templates/odfedit.h | 17 +++++ src/templates/templates.cpp | 24 +++++++ src/templates/templates.h | 9 +++ 15 files changed, 294 insertions(+), 82 deletions(-) diff --git a/src/dialogs/eventsummary.cpp b/src/dialogs/eventsummary.cpp index f44768f..c71ec44 100644 --- a/src/dialogs/eventsummary.cpp +++ b/src/dialogs/eventsummary.cpp @@ -110,6 +110,11 @@ MEventSummary::MEventSummary(QWidget*par,qint64 eid) MEventSummary::~MEventSummary(){} +void MEventSummary::setTestTemplateFile(const QString& t) +{ + testTemplate=t; +} + void MEventSummary::getSummaryData() { MTGetEventSummary ges=req->queryGetEventSummary(eventid); @@ -170,21 +175,29 @@ void MEventSummary::getSummaryData() void MEventSummary::print() { - MTemplate tf=req->templateStore()->getTemplate("eventsummary"); + MTemplate tf; + if(testTemplate.isEmpty()) + tf=req->templateStore()->getTemplate("eventsummary"); + else + tf.setFile(testTemplate); if(!tf.isValid()){ QMessageBox::warning(this,tr("Warning"),tr("Unable to get template file (eventsummary). Giving up.")); return; } MOdtSignalRenderer rend(tf); connect(&rend,SIGNAL(getVariable(QString,QVariant&)), this,SLOT(getVariable(QString,QVariant&))); - connect(&rend,SIGNAL(getLoopIterations(QString,int&)),this,SLOT(getLoopIterations(QString,int&))); + connect(&rend,SIGNAL(getLoopIterations(QString,int&)), this,SLOT(getLoopIterations(QString,int&))); connect(&rend,SIGNAL(setLoopIteration(QString,int)), this,SLOT(setLoopIteration(QString,int))); rend.renderToPrinter(); } void MEventSummary::saveas() { - MTemplate tf=req->templateStore()->getTemplate("eventsummary"); + MTemplate tf; + if(testTemplate.isEmpty()) + tf=req->templateStore()->getTemplate("eventsummary"); + else + tf.setFile(testTemplate); if(!tf.isValid()){ QMessageBox::warning(this,tr("Warning"),tr("Unable to get template file (eventsummary). Giving up.")); return; diff --git a/src/dialogs/eventsummary.h b/src/dialogs/eventsummary.h index bc511bd..06e7191 100644 --- a/src/dialogs/eventsummary.h +++ b/src/dialogs/eventsummary.h @@ -34,6 +34,9 @@ class MEventSummary:public QDialog /**deletes MEventSummary*/ ~MEventSummary(); + ///set a test template + void setTestTemplateFile(const QString&); + private slots: /**internal: print summary*/ void print(); @@ -64,6 +67,7 @@ class MEventSummary:public QDialog QMaporders; QMapcustomers; QMaploopiter; + QString testTemplate; //get summary void getSummaryData(); diff --git a/src/dialogs/orderwin.cpp b/src/dialogs/orderwin.cpp index 62647d1..ea0485d 100644 --- a/src/dialogs/orderwin.cpp +++ b/src/dialogs/orderwin.cpp @@ -206,6 +206,11 @@ MOrderWindow::MOrderWindow(QWidget*par,const MOOrder&o) updateData(); } +void MOrderWindow::setTestTemplateFile(QString tf) +{ + m_testTemplate=tf; +} + static const int ITEM_TICKET=1; static const int ITEM_VOUCHER=2; static const int ITEM_ITEM=3; @@ -415,7 +420,11 @@ void MOrderWindow::printVouchers(QList vouchersin) void MOrderWindow::printBill() { //get template - MTemplate tf=req->templateStore()->getTemplate("bill"); + MTemplate tf; + if(m_testTemplate.isEmpty()){ + tf=req->templateStore()->getTemplate("bill"); + }else + tf.setFile(m_testTemplate); if(!tf.isValid()){ QMessageBox::warning(this,tr("Warning"),tr("Unable to get template file (bill). Giving up.")); return; @@ -440,7 +449,11 @@ void MOrderWindow::printBill() void MOrderWindow::saveBill() { //get template - MTemplate tf=req->templateStore()->getTemplate("bill"); + MTemplate tf; + if(m_testTemplate.isEmpty()) + tf=req->templateStore()->getTemplate("bill"); + else + tf.setFile(m_testTemplate); if(!tf.isValid()){ QMessageBox::warning(this,tr("Warning"),tr("Unable to get template file (bill). Giving up.")); return; diff --git a/src/dialogs/orderwin.h b/src/dialogs/orderwin.h index 50b7e19..f7636ef 100644 --- a/src/dialogs/orderwin.h +++ b/src/dialogs/orderwin.h @@ -35,6 +35,9 @@ class MOrderWindow:public QMainWindow public: /**creates the order window*/ MOrderWindow(QWidget*,const MOOrder&); + + /**used by the ODF editor: sets the template file to use for testing*/ + void setTestTemplateFile(QString); private slots: /**internal: updates the labels and the ticket table*/ @@ -117,6 +120,7 @@ class MOrderWindow:public QMainWindow QStandardItemModel *m_model; QAction*m_res2order,*m_cancel,*m_ship,*m_pay,*m_payv,*m_refund; QMapm_loopiter; + QString m_testTemplate; //printing buffer struct TickInfo{ diff --git a/src/mwin/carttab.cpp b/src/mwin/carttab.cpp index 333a5b7..68eddc8 100644 --- a/src/mwin/carttab.cpp +++ b/src/mwin/carttab.cpp @@ -283,35 +283,10 @@ static const int CART_TYPEROLE=Qt::UserRole+2;//which is it? ticket or voucher? void MCartTab::cartAddTicket() { - QStandardItemModel*eventmodel=emit eventModel(); - if(!eventmodel)return; //create ticket selection dialog - QDialog dlg; - dlg.setWindowTitle(tr("Select Event to order Ticket")); - QTableView*tv; - QHBoxLayout*hl; - QVBoxLayout*vl; - dlg.setLayout(vl=new QVBoxLayout); - vl->addWidget(tv=new QTableView,10); - tv->setModel(eventmodel); - tv->setEditTriggers(QAbstractItemView::NoEditTriggers); - tv->resizeColumnsToContents(); - vl->addSpacing(15); - vl->addLayout(hl=new QHBoxLayout,0); - hl->addStretch(10); - QPushButton*p; - hl->addWidget(p=new QPushButton(tr("Select")),0); - connect(p,SIGNAL(clicked()),&dlg,SLOT(accept())); - connect(tv,SIGNAL(doubleClicked(const QModelIndex&)),&dlg,SLOT(accept())); - hl->addWidget(p=new QPushButton(tr("Cancel")),0); - connect(p,SIGNAL(clicked()),&dlg,SLOT(reject())); - //wait for it - if(dlg.exec()!=QDialog::Accepted)return; - //get selection - QModelIndex idx=tv->currentIndex(); - if(!idx.isValid())return; - int id=eventmodel->data(eventmodel->index(idx.row(),0),Qt::UserRole).toInt(); - if(id<0)return; + int id=-1;bool ok=false; + getEventId(id,ok); + if(id<0 || !ok)return; addTicketForEvent(id); } diff --git a/src/mwin/carttab.h b/src/mwin/carttab.h index d177975..8601908 100644 --- a/src/mwin/carttab.h +++ b/src/mwin/carttab.h @@ -56,9 +56,6 @@ class MCartTab:public QWidget ~MCartTab(); signals: - /**must be connected to the slot in the event tab: returns the event model - TODO: refactor to be more elegant - don't use model!*/ - QStandardItemModel*eventModel(); /**must be connected to the slot in the event tab: returns the currently selected event ID*/ int currentEventId(); /**must be connected to the slot in the event tab: returns the currently selected event title*/ @@ -69,6 +66,9 @@ class MCartTab:public QWidget /**emitted when the cart tab wants focus because something important changed*/ void requestFocus(); + ///select an event + void getEventId(int&,bool&); + public slots: /**order ticket from event tab*/ void eventOrderTicket(); diff --git a/src/mwin/eventstab.cpp b/src/mwin/eventstab.cpp index 2ecf623..ad00701 100644 --- a/src/mwin/eventstab.cpp +++ b/src/mwin/eventstab.cpp @@ -242,3 +242,50 @@ void MEventsTab::editPriceCat() { MPriceCategoryDialog(this,false).exec(); } + +void MEventsTab::selectEventId(int& eid, bool& ok) const +{ + QListids; + selectEventIds(ids,false); + ok=ids.size()>=1; + if(ok)eid=ids[0]; +} + +void MEventsTab::selectEventIds(QList< int >& eids, bool multi) const +{ + eids.clear(); + QDialog dlg; + dlg.setWindowTitle(tr("Select Event")); + QTableView*tv; + QHBoxLayout*hl; + QVBoxLayout*vl; + dlg.setLayout(vl=new QVBoxLayout); + vl->addWidget(tv=new QTableView,10); + tv->setModel(eventmodel); + tv->setEditTriggers(QAbstractItemView::NoEditTriggers); + tv->setSelectionBehavior(QAbstractItemView::SelectRows); + tv->setSelectionMode(multi?QAbstractItemView::MultiSelection:QAbstractItemView::SingleSelection); + tv->resizeColumnsToContents(); + vl->addSpacing(15); + vl->addLayout(hl=new QHBoxLayout,0); + hl->addStretch(10); + QPushButton*p; + hl->addWidget(p=new QPushButton(tr("Select")),0); + connect(p,SIGNAL(clicked()),&dlg,SLOT(accept())); + connect(tv,SIGNAL(doubleClicked(const QModelIndex&)),&dlg,SLOT(accept())); + hl->addWidget(p=new QPushButton(tr("Cancel")),0); + connect(p,SIGNAL(clicked()),&dlg,SLOT(reject())); + //wait for it + if(dlg.exec()!=QDialog::Accepted)return; + //get selection + QModelIndexList ilst=tv->selectionModel()->selectedIndexes(); + if(ilst.size()<1){ + qDebug("nothing selected"); + return; + } + //get events + for(int i=0;idata(eventmodel->index(ilst[i].row(),0),Qt::UserRole).toInt(); + if(!eids.contains(eid))eids.append(eid); + } +} diff --git a/src/mwin/eventstab.h b/src/mwin/eventstab.h index 3de1149..4c48108 100644 --- a/src/mwin/eventstab.h +++ b/src/mwin/eventstab.h @@ -57,8 +57,6 @@ class MEventsTab:public QWidget /**edit price categories*/ void editPriceCat(); public slots: - /**returns event table model*/ - QStandardItemModel*eventModel(){return eventmodel;} /**returns the currently selected event (as ID) or -1 if none is selected*/ int currentEventId()const; /**returns the currently selected event start time as string*/ @@ -68,6 +66,15 @@ class MEventsTab:public QWidget /**update list of events*/ void updateEvents(); + + ///shows an event selection dialog and returns the selected event + /// \param eid the ID of the selected event, if the dialog was normally closed + /// \param ok true if the dialog was closed normally, false if the user aborted + void selectEventId(int&eid,bool&ok)const; + ///shows an event selection dialog and returns the selected event + /// \param eids the list of IDs of the selected events, empty if nothing was selected or the user aborted + /// \param multi true if multiple IDs can be selected, false if only one can be selec ted + void selectEventIds(QList&eids,bool multi=true)const; signals: /**order ticket from event tab*/ diff --git a/src/mwin/orderstab.cpp b/src/mwin/orderstab.cpp index d10d092..7d54c27 100644 --- a/src/mwin/orderstab.cpp +++ b/src/mwin/orderstab.cpp @@ -289,40 +289,12 @@ void MOrdersTab::orderByTicket() void MOrdersTab::orderByEvent() { - //display selection dialog - QDialog d(this); - d.setWindowTitle(tr("Select Event")); - QVBoxLayout*vl; - QHBoxLayout*hl; - d.setLayout(vl=new QVBoxLayout); - QTableView*tv; - vl->addWidget(tv=new QTableView,10); - tv->setEditTriggers(QAbstractItemView::NoEditTriggers); - QStandardItemModel*eventmodel=emit eventModel(); - tv->setModel(eventmodel); - tv->resizeColumnsToContents(); - vl->addLayout(hl=new QHBoxLayout,0); - hl->addStretch(10); - QPushButton*p; - hl->addWidget(p=new QPushButton(tr("Ok")),0); - connect(p,SIGNAL(clicked()),&d,SLOT(accept())); - hl->addWidget(p=new QPushButton(tr("Cancel")),0); - connect(p,SIGNAL(clicked()),&d,SLOT(reject())); - //wait for user - if(d.exec()!=QDialog::Accepted) - return; - //get selection - QModelIndexList ilst=tv->selectionModel()->selectedIndexes(); - if(ilst.size()<1){ - qDebug("nothing selected"); - return; - } //get events QListeventids; - for(int i=0;idata(eventmodel->index(ilst[i].row(),0),Qt::UserRole).toInt(); - if(!eventids.contains(eid))eventids.append(eid); - } + QListeids; + selectEventIds(eids); + if(eids.size()<1)return; + for(int id:eids)eventids.append(id); //request data and display resetModel(); MTGetOrdersByEvents obe=req->queryGetOrdersByEvents(eventids,oldestOrderStamp(OldestForEvent)); diff --git a/src/mwin/orderstab.h b/src/mwin/orderstab.h index 9942ccd..9615d95 100644 --- a/src/mwin/orderstab.h +++ b/src/mwin/orderstab.h @@ -59,7 +59,7 @@ class MOrdersTab:public QWidget signals: /**needs to be connected to the event tab*/ - QStandardItemModel*eventModel(); + void selectEventIds(QList&); private: /**helper function: enters a single order into the model*/ diff --git a/src/mwin/overview.cpp b/src/mwin/overview.cpp index 860a510..de407d0 100644 --- a/src/mwin/overview.cpp +++ b/src/mwin/overview.cpp @@ -154,7 +154,7 @@ MOverview::MOverview(QString pk) carttab=new MCartTab(pk); addTab(carttab,tr("Shopping Cart"),carttab->menu()); connect(eventtab,SIGNAL(eventOrderTicket()),carttab,SLOT(eventOrderTicket())); - connect(carttab,SIGNAL(eventModel()), eventtab,SLOT(eventModel()), Qt::DirectConnection); + connect(carttab,SIGNAL(getEventId(int&,bool&)), eventtab,SLOT(selectEventId(int&,bool&)), Qt::DirectConnection); connect(carttab,SIGNAL(currentEventId()), eventtab,SLOT(currentEventId()), Qt::DirectConnection); connect(carttab,SIGNAL(currentEventTitle()), eventtab,SLOT(currentEventTitle()), Qt::DirectConnection); connect(carttab,SIGNAL(currentEventStart()), eventtab,SLOT(currentEventStart()), Qt::DirectConnection); @@ -162,7 +162,7 @@ MOverview::MOverview(QString pk) //Order List Tab addTab(ordertab=new MOrdersTab(pk),tr("Order List")); - connect(ordertab,SIGNAL(eventModel()), eventtab,SLOT(eventModel()), Qt::DirectConnection); + connect(ordertab,SIGNAL(selectEventIds(QList&)), eventtab,SLOT(selectEventIds(QList&)), Qt::DirectConnection); //Entrance Control Tab entrancetab=new MEntranceTab(pk); @@ -613,6 +613,7 @@ void MOverview::editTemplates() void MOverview::editOdfTemplate() { MOdfEditor *oe=new MOdfEditor(this); + connect(oe,SIGNAL(getEvent(int&,bool&)),eventtab,SLOT(selectEventId(int&,bool&))); oe->show(); } diff --git a/src/templates/odfedit.cpp b/src/templates/odfedit.cpp index 6ebe313..0cf7ae0 100644 --- a/src/templates/odfedit.cpp +++ b/src/templates/odfedit.cpp @@ -18,8 +18,11 @@ #include "lambda.h" #include "vlambda.h" -#include "MOTicket" -#include "MOVoucher" +#include "orderwin.h" +#include "eventsummary.h" + +#include "MOOrder" +#include "msinterface.h" #include @@ -42,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -59,6 +63,7 @@ #include #include #include +#include class DPTR_CLASS_NAME(MOdfEditor) @@ -82,13 +87,18 @@ class DPTR_CLASS_NAME(MOdfEditor) QStackedWidget*mStack; QLabel*mSpecial; //tree menu - QAction*maAddIntoCalc,*maWrapInCond,*maAddIntoComment,*maInsBehindElse,*maWrapInLoop; + QAction*maAddIntoCalc,*maWrapInCond,*maAddIntoComment; + QAction*maInsBehindElse,*maWrapInLoop; QAction*maInsBehindCalc,*maInsBehindComment,*maUnwrap,*maDelItem; void setActions(const QList&); //current node QModelIndex mCurIndex; QDomNode mCurNode; bool mChanged; + //test printing + QString mTestFile; + QPointermTestOrderWin; + QPointermTestEventWin; //file contents struct File{ QString name; @@ -150,11 +160,9 @@ MOdfEditor::MOdfEditor(QWidget* parent, Qt::WindowFlags f): QMainWindow(parent, d->maUnwrap=m->addAction(tr("Unwrap Loop/Condition"),this,SLOT(unwrapItem())); d->maDelItem=m->addAction(tr("&Remove Item"),this,SLOT(delItem())); - m=mb->addMenu(tr("&Data")); - m->addAction(tr("Import from Order...")); - m->addSeparator(); - m->addAction(tr("Test Printing...")); - m->addAction(tr("Save Test Document...")); + m=mb->addMenu(tr("&Test")); + m->addAction(tr("Test with &Order..."),this,SLOT(testOrder())); + m->addAction(tr("Test with Event &Summary..."),this,SLOT(testEventSum())); //central QSplitter*central=new QSplitter(Qt::Vertical); @@ -274,6 +282,23 @@ MOdfEditor::MOdfEditor(QWidget* parent, Qt::WindowFlags f): QMainWindow(parent, updateDisplay(); } +MOdfEditor::~MOdfEditor() +{ + cleanTestFile(); +} + +void MOdfEditor::cleanTestFile() +{ + if(!d->mTestFile.isEmpty()){ + QFile(d->mTestFile).remove(); + d->mTestFile.clear(); + } + if(d->mTestOrderWin) + d->mTestOrderWin->deleteLater(); + if(d->mTestEventWin) + d->mTestEventWin->deleteLater(); +} + void MOdfEditor::setChanged(bool ch) { if(ch!=d->mChanged) @@ -284,6 +309,7 @@ void MOdfEditor::setChanged(bool ch) void MOdfEditor::loadFile(QString fn,bool istempl) { qDebug()<<"loading ODF template file"<mFileName); + QString fn=QFileDialog::getSaveFileName(this,tr("Save ODF Template"),d->mFileName,tr("ODF Template (*%1);;All ODF Templates (*.od?t);;All Files (*)").arg(detectTemplateType())); if(fn!=""){ d->mFileName=fn; saveFile(fn); @@ -406,6 +432,106 @@ void MOdfEditor::saveFileAs() } } +void MOdfEditor::testSave() +{ + //generate temp file + if(d->mTestFile.isEmpty()){ + QTemporaryFile tf(QDir::tempPath()+"/msmokeXXXXXX"+QFileInfo(d->mFileName).completeBaseName()+detectTemplateType()); + tf.setAutoRemove(false); + tf.open(); + d->mTestFile=tf.fileName(); + } + //save the file + saveFile(d->mTestFile); +} + +QString MOdfEditor::detectTemplateType() const +{ + //get document + QDomDocument doc=d->mDomModel->domDocument(); + if(doc.isNull())return QString(); + //recurse through elements: helper lambda to do it + const auto findElement=[](const QDomElement&el,const QString&nm)->QDomElement{ + QDomNodeList nl=el.childNodes(); + for(int i=0;i *:document-content + el=findElement(el,"document-content"); + if(el.isNull())return QString(); + //-> *:-> *:body + el=findElement(el,"body"); + if(el.isNull())return QString(); + // -> *:text(odtt)/spreadsheet(odst)/database(odbt)/drawing(odgt)/presentation(odpt) + QDomNodeList nl=el.childNodes(); + for(int i=0;imTestOrderWin.isNull()){ + bool ok; + qint64 oid=QInputDialog::getInt(this,tr("Test with Order"),tr("Please enter the Order ID of the order you want to use for testing:"),0,0,0x7fffffff,1,&ok); + if(!ok)return; + MTGetOrder go=req->queryGetOrder(oid); + if(go.hasError()){ + QMessageBox::warning(this,tr("Warning"),tr("Sorry I cannot retrieve this order: %1").arg(go.errorString())); + return; + } + MOOrder ord=go.getorder(); + d->mTestOrderWin=new MOrderWindow(this,ord); + d->mTestOrderWin->setTestTemplateFile(d->mTestFile); + } + //bring into foreground + d->mTestOrderWin->show(); + d->mTestOrderWin->raise(); + d->mTestOrderWin->activateWindow(); +} + +void MOdfEditor::testEventSum() +{ + //save it + testSave(); + //create window + if(d->mTestEventWin.isNull()){ + //get event + int eid=-1;bool ok=false; + getEvent(eid,ok); + if(!ok || eid<0)return; + //open + d->mTestEventWin=new MEventSummary(this,eid); + d->mTestEventWin->setTestTemplateFile(d->mTestFile); + } + //bring into foreground + d->mTestEventWin->show(); + d->mTestEventWin->raise(); + d->mTestEventWin->activateWindow(); +} + void MOdfEditor::updateDisplay() { if(d->mFileName=="") diff --git a/src/templates/odfedit.h b/src/templates/odfedit.h index ab38921..241b5d7 100644 --- a/src/templates/odfedit.h +++ b/src/templates/odfedit.h @@ -19,6 +19,7 @@ #include +class MOEvent; class QFile; class QIODevice; class QDomNode; @@ -30,6 +31,8 @@ class MOdfEditor:public QMainWindow public: ///instantiates the editor MOdfEditor(QWidget* parent = 0, Qt::WindowFlags f = 0); + ///clean it up + virtual ~MOdfEditor(); public slots: ///loads a template file, this is a helper for openFile and download @@ -76,14 +79,28 @@ class MOdfEditor:public QMainWindow void wrapInLoop(); ///helper: unwrap the loop or condition void unwrapItem(); + + ///helper: test new template on an order + void testOrder(); + ///helper: test new template on an event summary + void testEventSum(); + ///helper: save into the test file + void testSave(); signals: ///used to switch to the correct editor widget void switchStack(int); + ///used to select an event + void getEvent(int&,bool&); private: ///helper to save the current node when selection changes void saveCurrentNode(); ///helper to display a tag void displayTag(); + ///helper to determine template type + /// \returns correct file extension (.odtt, .odst, ...) or empty string if the type cannot be determined + QString detectTemplateType()const; + ///cleans up the test file + void cleanTestFile(); }; #endif diff --git a/src/templates/templates.cpp b/src/templates/templates.cpp index 911d53e..a7ffcd9 100644 --- a/src/templates/templates.cpp +++ b/src/templates/templates.cpp @@ -302,6 +302,30 @@ MTemplate::MTemplate(){} MTemplate::MTemplate(QString fn){m_fname=fn;} MTemplate::MTemplate(QString fn,QString chk,QString dsc,QString flg) {m_fname=fn;m_checksum=chk;m_descr=dsc;m_flags=flg;} + +MTemplate::MTemplate(const MTemplate& t) +{ + m_fname=t.m_fname; + m_checksum=t.m_checksum; + m_descr=t.m_descr; + m_flags=t.m_flags; +} + +MTemplate& MTemplate::operator=(const MTemplate&t) +{ + m_fname=t.m_fname; + m_checksum=t.m_checksum; + m_descr=t.m_descr; + m_flags=t.m_flags; + return *this; +} + +void MTemplate::setFile(const QString& s) +{ + m_fname=s; + m_checksum=m_descr=m_flags=QString(); +} + QString MTemplate::cacheFileName()const{return m_fname;} QString MTemplate::fileName()const diff --git a/src/templates/templates.h b/src/templates/templates.h index 02bcece..233e880 100644 --- a/src/templates/templates.h +++ b/src/templates/templates.h @@ -25,6 +25,15 @@ class MTemplate /**creates a temporary template by a physical file name*/ MTemplate(QString fn); + /**copies a template*/ + MTemplate(const MTemplate&); + + ///copies a template + MTemplate& operator=(const MTemplate&); + + ///reinitializes the template from the given file name + void setFile(const QString&); + /**returns the name/path of the cache file, if it exists*/ QString cacheFileName()const; -- 1.7.2.5