mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-02-02 18:36:49 +01:00
Introduce RootItem class hashCode idea.
This commit is contained in:
parent
b4b244d634
commit
4cd04d03db
@ -108,7 +108,7 @@ void FeedsView::saveExpandedStates() {
|
|||||||
|
|
||||||
// Iterate all categories and save their expand statuses.
|
// Iterate all categories and save their expand statuses.
|
||||||
foreach (RootItem *item, expandable_items) {
|
foreach (RootItem *item, expandable_items) {
|
||||||
QString setting_name = QString::number(item->kind()) + QL1S("-") + QString::number(qHash(item->title())) + QL1S("-") + QString::number(item->id());
|
QString setting_name = item->hashCode();
|
||||||
|
|
||||||
settings->setValue(GROUP(Categories),
|
settings->setValue(GROUP(Categories),
|
||||||
setting_name,
|
setting_name,
|
||||||
@ -124,7 +124,7 @@ void FeedsView::loadExpandedStates() {
|
|||||||
|
|
||||||
// Iterate all categories and save their expand statuses.
|
// Iterate all categories and save their expand statuses.
|
||||||
foreach (RootItem *item, expandable_items) {
|
foreach (RootItem *item, expandable_items) {
|
||||||
QString setting_name = QString::number(item->kind()) + QL1S("-") + QString::number(qHash(item->title())) + QL1S("-") + QString::number(item->id());
|
QString setting_name = item->hashCode();
|
||||||
|
|
||||||
setExpanded(model()->mapFromSource(sourceModel()->indexForItem(item)),
|
setExpanded(model()->mapFromSource(sourceModel()->indexForItem(item)),
|
||||||
settings->value(GROUP(Categories), setting_name, item->childCount() > 0).toBool());
|
settings->value(GROUP(Categories), setting_name, item->childCount() > 0).toBool());
|
||||||
|
@ -43,6 +43,13 @@ RootItem::~RootItem() {
|
|||||||
qDeleteAll(m_childItems);
|
qDeleteAll(m_childItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString RootItem::hashCode() const {
|
||||||
|
return
|
||||||
|
QString::number(kind()) + QL1S("-") +
|
||||||
|
QString::number(qHash(title())) + QL1S("-") +
|
||||||
|
QString::number(id());
|
||||||
|
}
|
||||||
|
|
||||||
QList<QAction*> RootItem::contextMenu() {
|
QList<QAction*> RootItem::contextMenu() {
|
||||||
return QList<QAction*>();
|
return QList<QAction*>();
|
||||||
}
|
}
|
||||||
|
@ -74,6 +74,8 @@ class RootItem : public QObject {
|
|||||||
// /* Members to override.
|
// /* Members to override.
|
||||||
/////////////////////////////////////////
|
/////////////////////////////////////////
|
||||||
|
|
||||||
|
virtual QString hashCode() const;
|
||||||
|
|
||||||
// Returns list of specific actions which can be done with the item.
|
// Returns list of specific actions which can be done with the item.
|
||||||
// Do not include general actions here like actions: Mark as read, Update, ...
|
// Do not include general actions here like actions: Mark as read, Update, ...
|
||||||
// NOTE: Ownership of returned actions is not switched to caller, free them when needed.
|
// NOTE: Ownership of returned actions is not switched to caller, free them when needed.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user