mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-12 12:54:29 +00:00
Replaced the ItemState structure with QPair<KFileItem, KVersionControlPlugin2::ItemVersion>
This commit is contained in:
parent
93465171bc
commit
9c6c0089c9
|
@ -57,12 +57,15 @@ void UpdateItemStatesThread::run()
|
||||||
KVersionControlPlugin2* pluginV2 = qobject_cast<KVersionControlPlugin2*>(m_plugin);
|
KVersionControlPlugin2* pluginV2 = qobject_cast<KVersionControlPlugin2*>(m_plugin);
|
||||||
if (pluginV2) {
|
if (pluginV2) {
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
items[i].version = pluginV2->itemVersion(items[i].item);
|
const KFileItem& item = items.at(i).first;
|
||||||
|
const KVersionControlPlugin2::ItemVersion version = pluginV2->itemVersion(item);
|
||||||
|
items[i].second = version;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
const KVersionControlPlugin::VersionState state = m_plugin->versionState(items[i].item);
|
const KFileItem& item = items.at(i).first;
|
||||||
items[i].version = static_cast<KVersionControlPlugin2::ItemVersion>(state);
|
const KVersionControlPlugin::VersionState state = m_plugin->versionState(item);
|
||||||
|
items[i].second = static_cast<KVersionControlPlugin2::ItemVersion>(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,9 +205,11 @@ void VersionControlObserver::slotThreadFinished()
|
||||||
const QVector<ItemState>& items = it.value();
|
const QVector<ItemState>& items = it.value();
|
||||||
|
|
||||||
foreach (const ItemState& item, items) {
|
foreach (const ItemState& item, items) {
|
||||||
|
const KFileItem& fileItem = item.first;
|
||||||
|
const KVersionControlPlugin2::ItemVersion version = item.second;
|
||||||
QHash<QByteArray, QVariant> values;
|
QHash<QByteArray, QVariant> values;
|
||||||
values.insert("version", QVariant(item.version));
|
values.insert("version", QVariant(version));
|
||||||
m_model->setData(m_model->index(item.item), values);
|
m_model->setData(m_model->index(fileItem), values);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,8 +268,8 @@ int VersionControlObserver::createItemStatesList(QMap<QString, QVector<ItemState
|
||||||
|
|
||||||
if (expansionLevel == currentExpansionLevel) {
|
if (expansionLevel == currentExpansionLevel) {
|
||||||
ItemState itemState;
|
ItemState itemState;
|
||||||
itemState.item = m_model->fileItem(index);
|
itemState.first = m_model->fileItem(index);
|
||||||
itemState.version = KVersionControlPlugin2::UnversionedVersion;
|
itemState.second = KVersionControlPlugin2::UnversionedVersion;
|
||||||
|
|
||||||
items.append(itemState);
|
items.append(itemState);
|
||||||
} else if (expansionLevel > currentExpansionLevel) {
|
} else if (expansionLevel > currentExpansionLevel) {
|
||||||
|
@ -279,7 +281,7 @@ int VersionControlObserver::createItemStatesList(QMap<QString, QVector<ItemState
|
||||||
}
|
}
|
||||||
|
|
||||||
if (items.count() > 0) {
|
if (items.count() > 0) {
|
||||||
const KUrl& url = items.first().item.url();
|
const KUrl& url = items.first().first.url();
|
||||||
itemStates.insert(url.directory(KUrl::AppendTrailingSlash), items);
|
itemStates.insert(url.directory(KUrl::AppendTrailingSlash), items);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,11 +101,7 @@ private slots:
|
||||||
void slotThreadFinished();
|
void slotThreadFinished();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct ItemState
|
typedef QPair<KFileItem, KVersionControlPlugin2::ItemVersion> ItemState;
|
||||||
{
|
|
||||||
KFileItem item;
|
|
||||||
KVersionControlPlugin2::ItemVersion version;
|
|
||||||
};
|
|
||||||
|
|
||||||
void updateItemStates();
|
void updateItemStates();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue