This commit is contained in:
Martin Rotter 2014-10-16 17:23:47 +02:00
parent c0c623ead5
commit 91f9dd7a9c
7 changed files with 47 additions and 10 deletions

View File

@ -3,13 +3,14 @@
Fixed:
<ul>
<li>Fixed #76, #75, #82, #79, #85 #78</li>
<li>Fixed #76, #75, #82, #79, #85 #78, #92.</li>
</ul>
Added:
<ul>
<li>Settings/database can now experimentally be exported/imported.</li>
<li>Added Swedish localization (thanks to Åke Engelbrektson).</li>
<li>Parent item is now selected when adding new category/feed with that parent pre-selected in feed view.</li>
</ul>
Changed:

View File

@ -110,6 +110,17 @@ QList<FeedsModelFeed*> FeedsView::allFeeds() const {
return m_sourceModel->allFeeds();
}
FeedsModelRootItem *FeedsView::selectedItem() const {
QModelIndexList selected_rows = selectionModel()->selectedRows();
if (selected_rows.isEmpty()) {
return NULL;
}
FeedsModelRootItem *selected_item = m_sourceModel->itemForIndex(m_proxyModel->mapToSource(selected_rows.at(0)));
return selected_item == m_sourceModel->rootItem() ? NULL : selected_item;
}
FeedsModelCategory *FeedsView::selectedCategory() const {
QModelIndex current_mapped = m_proxyModel->mapToSource(currentIndex());
return m_sourceModel->categoryForIndex(current_mapped);
@ -246,7 +257,7 @@ void FeedsView::addNewCategory() {
QPointer<FormCategoryDetails> form_pointer = new FormCategoryDetails(m_sourceModel, this);
form_pointer.data()->exec(NULL, NULL);
form_pointer.data()->exec(NULL, selectedItem());
delete form_pointer.data();
@ -275,7 +286,7 @@ void FeedsView::addNewFeed() {
QPointer<FormFeedDetails> form_pointer = new FormFeedDetails(m_sourceModel, this);
form_pointer.data()->exec(NULL);
form_pointer.data()->exec(NULL, selectedItem());
delete form_pointer.data();
@ -286,7 +297,7 @@ void FeedsView::addNewFeed() {
void FeedsView::editFeed(FeedsModelFeed *feed) {
QPointer<FormFeedDetails> form_pointer = new FormFeedDetails(m_sourceModel, this);
form_pointer.data()->exec(feed);
form_pointer.data()->exec(feed, NULL);
delete form_pointer.data();
}

View File

@ -61,6 +61,7 @@ class FeedsView : public QTreeView {
// Returns pointers to selected feed/category if they are really
// selected.
FeedsModelRootItem *selectedItem() const;
FeedsModelCategory *selectedCategory() const;
FeedsModelFeed *selectedFeed() const;
FeedsModelRecycleBin *selectedRecycleBin() const;
@ -113,9 +114,7 @@ class FeedsView : public QTreeView {
// Is called when counts of messages are changed externally,
// typically from message view.
void receiveMessageCountsChange(MessagesModel::MessageMode mode,
bool total_msg_count_changed,
bool any_msg_restored);
void receiveMessageCountsChange(MessagesModel::MessageMode mode, bool total_msg_count_changed, bool any_msg_restored);
// Reloads counts for selected feeds.
void updateCountsOfSelectedFeeds(bool update_total_too);

View File

@ -92,6 +92,20 @@ int FormCategoryDetails::exec(FeedsModelCategory *input_category, FeedsModelRoot
// Make sure that "default" icon is used as the default option for new
// categories.
m_actionUseDefaultIcon->trigger();
// Load parent from suggested item.
if (parent_to_select != NULL) {
if (parent_to_select->kind() == FeedsModelRootItem::Category) {
m_ui->m_cmbParentCategory->setCurrentIndex(m_ui->m_cmbParentCategory->findData(QVariant::fromValue((void*) parent_to_select)));
}
else if (parent_to_select->kind() == FeedsModelRootItem::Feed) {
int target_item = m_ui->m_cmbParentCategory->findData(QVariant::fromValue((void*) parent_to_select->parent()));
if (target_item >= 0) {
m_ui->m_cmbParentCategory->setCurrentIndex(target_item);
}
}
}
}
else {
// User is editing existing category.

View File

@ -56,7 +56,7 @@ FormFeedDetails::~FormFeedDetails() {
delete m_ui;
}
int FormFeedDetails::exec(FeedsModelFeed *input_feed) {
int FormFeedDetails::exec(FeedsModelFeed *input_feed, FeedsModelRootItem *parent_to_select) {
// Load categories.
loadCategories(m_feedsModel->allCategories().values(), m_feedsModel->rootItem());
@ -73,6 +73,19 @@ int FormFeedDetails::exec(FeedsModelFeed *input_feed) {
if (default_encoding_index >= 0) {
m_ui->m_cmbEncoding->setCurrentIndex(default_encoding_index);
}
if (parent_to_select != NULL) {
if (parent_to_select->kind() == FeedsModelRootItem::Category) {
m_ui->m_cmbParentCategory->setCurrentIndex(m_ui->m_cmbParentCategory->findData(QVariant::fromValue((void*) parent_to_select)));
}
else if (parent_to_select->kind() == FeedsModelRootItem::Feed) {
int target_item = m_ui->m_cmbParentCategory->findData(QVariant::fromValue((void*) parent_to_select->parent()));
if (target_item >= 0) {
m_ui->m_cmbParentCategory->setCurrentIndex(target_item);
}
}
}
}
else {
// User is editing existing category.

View File

@ -42,7 +42,7 @@ class FormFeedDetails : public QDialog {
public slots:
// Executes add/edit standard feed dialog.
int exec(FeedsModelFeed *input_feed);
int exec(FeedsModelFeed *input_feed, FeedsModelRootItem *parent_to_select);
protected slots:
// Applies changes.

View File

@ -95,7 +95,6 @@ bool DatabaseFactory::initiateRestoration(const QString &database_backup_file_pa
}
void DatabaseFactory::finishRestoration() {
// TODO: Finish restoration.
if (m_activeDatabaseDriver != SQLITE && m_activeDatabaseDriver != SQLITE_MEMORY) {
return;
}