Now, impor feature merges existing content.

This commit is contained in:
Martin Rotter 2014-09-04 15:52:42 +02:00
parent f044032f63
commit 418511bdc8
6 changed files with 45 additions and 9 deletions

View File

@ -16,7 +16,7 @@ Fixed:
Added:
<ul>
<li>Added NSIS-based "portable" installer for Windows and restructured update process.</li>
<li>Added experimental support for exporting feeds to OPML 2.0.</li>
<li>Added experimental support for exporting and importing feeds to/from OPML 2.0.</li>
<li>Feeds now change their color to red if their network status reports error - feed is not reachable or was moved or is unavailable due to other errors.</li>
</ul>

View File

@ -1,21 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<releases>
<release version="1.9.9.9" type="feature">
<url platform="x86" os="Windows">https://bitbucket.org/skunkos/rssguard/downloads/rssguard-2.0.0.0-win32-test.exe</url>
<release version="2.0.0.0" type="feature">
<url platform="x86" os="Windows">https://bitbucket.org/skunkos/rssguard/downloads/rssguard-2.0.0.0-win32.exe</url>
<changes>
<![CDATA[<body>
Fixed:
<ul>
<li>Improved behavior of updater.</li>
<li>Improved behavior of updater. Switched to NSIS installers.</li>
<li>Adjusted OS/2 icon handling.</li>
<li>Toolbars tweaked.</li>
<li>Source code huge refactorings.</li>
<li>Flag icons are now separated into their own directory.</li>
<li>File downloaders are now thinner.</li>
<li>GUI tweaked.</li>
<li>Database connections are only used when really needed.</li>
</ul>
Added:
<ul>
<li>Added NSIS-based "portable" installer for Windows and restructured update process.</li>
<li>Added experimental support for exporting and importing feeds to/from OPML 2.0.</li>
<li>Feeds now change their color to red if their network status reports error - feed is not reachable or was moved or is unavailable due to other errors.</li>
</ul>
Changed:
<ul>
<li>Added newly-compiled SQL libraries - MariaDB, Postgre SQL.</li>
<li>Updated bundled OpenSSL libraries for Windows portable version.</li>
</ul>
</body>]]>

View File

@ -565,7 +565,18 @@ bool FeedsModel::mergeModel(FeedsImportExportModel *model, QString &output_messa
new_parents.push(source_category);
}
else {
some_feed_category_error = true;
// Add category failed, but this can mean that the same category (with same title)
// already exists. If such a category exists in current parent, then find it and
// add descendants to it.
FeedsModelRootItem *existing_category = target_parent->child(FeedsModelRootItem::Category, new_category->title());
if (existing_category != NULL) {
original_parents.push(existing_category);
new_parents.push(source_category);
}
else {
some_feed_category_error = true;
}
}
}
else if (source_item->kind() == FeedsModelRootItem::Feed) {

View File

@ -18,6 +18,8 @@
#include "core/feedsmodelrootitem.h"
#include "miscellaneous/application.h"
#include "core/feedsmodelcategory.h"
#include "core/feedsmodelfeed.h"
#include <QVariant>
@ -78,6 +80,19 @@ bool FeedsModelRootItem::removeChild(FeedsModelRootItem *child) {
return m_childItems.removeOne(child);
}
FeedsModelRootItem *FeedsModelRootItem::child(FeedsModelRootItem::Kind kind_of_child, const QString &identifier) {
foreach (FeedsModelRootItem *child, childItems()) {
if (child->kind() == kind_of_child) {
if (kind_of_child == Category && static_cast<FeedsModelCategory*>(child)->title() == identifier ||
kind_of_child == Feed && static_cast<FeedsModelFeed*>(child)->url() == identifier) {
return child;
}
}
}
return NULL;
}
int FeedsModelRootItem::countOfUnreadMessages() const {
int total_count = 0;

View File

@ -53,6 +53,8 @@ class FeedsModelRootItem {
return m_childItems.value(row);
}
virtual FeedsModelRootItem *child(FeedsModelRootItem::Kind kind_of_child, const QString &identifier);
inline virtual int childCount() const {
return m_childItems.size();
}

View File

@ -240,16 +240,14 @@ void FormCategoryDetails::loadCategories(const QList<FeedsModelCategory*> catego
QVariant::fromValue((void*) root_item));
foreach (FeedsModelCategory *category, categories) {
if (input_category != NULL && (category == input_category ||
category->isChildOf(input_category))) {
if (input_category != NULL && (category == input_category || category->isChildOf(input_category))) {
// This category cannot be selected as the new
// parent for currently edited category, so
// don't add it.
continue;
}
m_ui->m_cmbParentCategory->addItem(category->data(FDS_MODEL_TITLE_INDEX,
Qt::DecorationRole).value<QIcon>(),
m_ui->m_cmbParentCategory->addItem(category->data(FDS_MODEL_TITLE_INDEX, Qt::DecorationRole).value<QIcon>(),
category->title(),
QVariant::fromValue((void*) category));
}