mirror of
https://invent.kde.org/system/dolphin
synced 2024-08-22 01:40:02 +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);
|
||||
if (pluginV2) {
|
||||
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 {
|
||||
for (int i = 0; i < count; ++i) {
|
||||
const KVersionControlPlugin::VersionState state = m_plugin->versionState(items[i].item);
|
||||
items[i].version = static_cast<KVersionControlPlugin2::ItemVersion>(state);
|
||||
const KFileItem& item = items.at(i).first;
|
||||
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();
|
||||
|
||||
foreach (const ItemState& item, items) {
|
||||
const KFileItem& fileItem = item.first;
|
||||
const KVersionControlPlugin2::ItemVersion version = item.second;
|
||||
QHash<QByteArray, QVariant> values;
|
||||
values.insert("version", QVariant(item.version));
|
||||
m_model->setData(m_model->index(item.item), values);
|
||||
values.insert("version", QVariant(version));
|
||||
m_model->setData(m_model->index(fileItem), values);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -266,8 +268,8 @@ int VersionControlObserver::createItemStatesList(QMap<QString, QVector<ItemState
|
|||
|
||||
if (expansionLevel == currentExpansionLevel) {
|
||||
ItemState itemState;
|
||||
itemState.item = m_model->fileItem(index);
|
||||
itemState.version = KVersionControlPlugin2::UnversionedVersion;
|
||||
itemState.first = m_model->fileItem(index);
|
||||
itemState.second = KVersionControlPlugin2::UnversionedVersion;
|
||||
|
||||
items.append(itemState);
|
||||
} else if (expansionLevel > currentExpansionLevel) {
|
||||
|
@ -279,7 +281,7 @@ int VersionControlObserver::createItemStatesList(QMap<QString, QVector<ItemState
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -101,11 +101,7 @@ private slots:
|
|||
void slotThreadFinished();
|
||||
|
||||
private:
|
||||
struct ItemState
|
||||
{
|
||||
KFileItem item;
|
||||
KVersionControlPlugin2::ItemVersion version;
|
||||
};
|
||||
typedef QPair<KFileItem, KVersionControlPlugin2::ItemVersion> ItemState;
|
||||
|
||||
void updateItemStates();
|
||||
|
||||
|
|
Loading…
Reference in a new issue