From 556c949058594d0086775367d0518d41c95bf308 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Tue, 2 Sep 2014 15:31:14 +0200 Subject: [PATCH] Save changes. --- .../georges_editor/georges_dfn_dialog.cpp | 22 +++++++++++++++++++ .../georges_editor/georges_dfn_dialog.h | 1 + 2 files changed, 23 insertions(+) diff --git a/code/studio/src/plugins/georges_editor/georges_dfn_dialog.cpp b/code/studio/src/plugins/georges_editor/georges_dfn_dialog.cpp index 59447ff9b..ef9abecf7 100644 --- a/code/studio/src/plugins/georges_editor/georges_dfn_dialog.cpp +++ b/code/studio/src/plugins/georges_editor/georges_dfn_dialog.cpp @@ -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() diff --git a/code/studio/src/plugins/georges_editor/georges_dfn_dialog.h b/code/studio/src/plugins/georges_editor/georges_dfn_dialog.h index 123faf39e..2410c66df 100644 --- a/code/studio/src/plugins/georges_editor/georges_dfn_dialog.h +++ b/code/studio/src/plugins/georges_editor/georges_dfn_dialog.h @@ -31,6 +31,7 @@ private: Ui::GeorgesDFNDialog m_ui; GeorgesDFNDialogPvt *m_pvt; + QString m_fileName; }; #endif