Save changes.

This commit is contained in:
dfighter1985 2014-09-02 15:31:14 +02:00
parent 298268b88e
commit bca9fd9347
2 changed files with 23 additions and 0 deletions

View file

@ -5,6 +5,10 @@
#include "georges.h"
#include "dfn_browser_ctrl.h"
#include "nel/misc/file.h"
#include "nel/misc/o_xml.h"
#include "nel/misc/path.h"
class GeorgesDFNDialogPvt
{
public:
@ -72,6 +76,8 @@ bool GeorgesDFNDialog::load( const QString &fileName )
m_ui.commentsEdit->setPlainText( cdfn->getComment().c_str() );
m_ui.logEdit->setPlainText( cdfn->Header.Log.c_str() );
m_fileName = fileName;
return true;
}
@ -79,6 +85,22 @@ void GeorgesDFNDialog::write()
{
setModified( false );
setWindowTitle( windowTitle().remove( "*" ) );
std::string path = NLMISC::CPath::lookup( m_fileName.toUtf8().constData(), false );
if( path.empty() )
return;
NLMISC::COFile file;
if( !file.open( path, false, true, false ) )
return;
NLMISC::COXml xml;
xml.init( &file );
m_pvt->dfn->write( xml.getDocument(), path.c_str() );
xml.flush();
file.close();
}
void GeorgesDFNDialog::onAddClicked()

View file

@ -31,6 +31,7 @@ private:
Ui::GeorgesDFNDialog m_ui;
GeorgesDFNDialogPvt *m_pvt;
QString m_fileName;
};
#endif