From 0392694560d530c14aced7ac21f85b18b676a685 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 21 Feb 2012 22:30:21 +0000 Subject: Initial support to preserve ini file comments --- src/zoneproperties.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/zoneproperties.cc') diff --git a/src/zoneproperties.cc b/src/zoneproperties.cc index 35d994a..43e4804 100644 --- a/src/zoneproperties.cc +++ b/src/zoneproperties.cc @@ -20,6 +20,19 @@ ZoneProperties::~ZoneProperties() void ZoneProperties::save(QTextStream & textstream) { + // comments + if (comment().size()) { + // QTextStream operates on QString, not on QString const + QString commentbuffer = comment(); + QTextStream commentstream(&commentbuffer); + QString line; + while (!commentstream.atEnd()) { + line = commentstream.readLine(1024); + textstream << line << '\n'; + } + textstream << '\n'; + } + textstream << "[zone]" << '\n'; if (name().size()) -- cgit v1.2.3