summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-06-04 00:40:54 +0300
committerAndrei Karas <akaras@inbox.ru>2012-06-04 00:40:54 +0300
commit23431afb89fdd0fd562485977f41fa258247ceec (patch)
tree4e455ad3bbf51f541225b2d5535da834bc59b09f /src/gui
parenta57a28014d09abdd695e31acb86a1dbdbedb5faa (diff)
downloadplus-23431afb89fdd0fd562485977f41fa258247ceec.tar.gz
plus-23431afb89fdd0fd562485977f41fa258247ceec.tar.bz2
plus-23431afb89fdd0fd562485977f41fa258247ceec.tar.xz
plus-23431afb89fdd0fd562485977f41fa258247ceec.zip
Add server news to help window.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/updaterwindow.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp
index eb2fe2f82..43185b418 100644
--- a/src/gui/updaterwindow.cpp
+++ b/src/gui/updaterwindow.cpp
@@ -44,6 +44,7 @@
#include "resources/resourcemanager.h"
#include "utils/gettext.h"
+#include "utils/mkdir.h"
#include "utils/paths.h"
#include "utils/stringutils.h"
#include "utils/xml.h"
@@ -296,11 +297,15 @@ void UpdaterWindow::loadNews()
mMemoryBuffer, mDownloadedBytes + 1));
mMemoryBuffer[mDownloadedBytes] = '\0';
-
mBrowserBox->clearRows();
-
// Tokenize and add each line separately
char *line = strtok(mMemoryBuffer, "\n");
+
+ std::string newsName = mUpdatesDir + "/local/help/news.txt";
+ mkdir_r((mUpdatesDir + "/local/help/").c_str());
+ std::ofstream file;
+ file.open(newsName.c_str(), std::ios::out);
+
bool firstLine(true);
while (line)
{
@@ -315,15 +320,20 @@ void UpdaterWindow::loadNews()
continue;
}
+ if (file.is_open())
+ file << str << std::endl;
mBrowserBox->addRow(str);
}
else
{
+ if (file.is_open())
+ file << line << std::endl;
mBrowserBox->addRow(line);
}
line = strtok(nullptr, "\n");
}
+ file.close();
// Free the memory buffer now that we don't need it anymore
free(mMemoryBuffer);
mMemoryBuffer = nullptr;