Save changes.
This commit is contained in:
parent
298268b88e
commit
bca9fd9347
2 changed files with 23 additions and 0 deletions
|
@ -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()
|
||||
|
|
|
@ -31,6 +31,7 @@ private:
|
|||
|
||||
Ui::GeorgesDFNDialog m_ui;
|
||||
GeorgesDFNDialogPvt *m_pvt;
|
||||
QString m_fileName;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue