Changeset View
Changeset View
Standalone View
Standalone View
svn/fileviewsvnplugin.cpp
Show First 20 Lines • Show All 220 Lines • ▼ Show 20 Line(s) | 207 | { | |||
---|---|---|---|---|---|
221 | // The item is a directory. Check whether an item listed by 'svn status' (= m_versionInfoHash) | 221 | // The item is a directory. Check whether an item listed by 'svn status' (= m_versionInfoHash) | ||
222 | // is part of this directory. In this case a local modification should be indicated in the | 222 | // is part of this directory. In this case a local modification should be indicated in the | ||
223 | // directory already. | 223 | // directory already. | ||
224 | const QString itemDir = itemUrl + QDir::separator(); | 224 | const QString itemDir = itemUrl + QDir::separator(); | ||
225 | QHash<QString, ItemVersion>::const_iterator it = m_versionInfoHash.constBegin(); | 225 | QHash<QString, ItemVersion>::const_iterator it = m_versionInfoHash.constBegin(); | ||
226 | while (it != m_versionInfoHash.constEnd()) { | 226 | while (it != m_versionInfoHash.constEnd()) { | ||
227 | if (it.key().startsWith(itemDir)) { | 227 | if (it.key().startsWith(itemDir)) { | ||
228 | const ItemVersion version = m_versionInfoHash.value(it.key()); | 228 | const ItemVersion version = m_versionInfoHash.value(it.key()); | ||
229 | if (version == LocallyModifiedVersion) { | 229 | if (version == LocallyModifiedVersion || version == AddedVersion || version == RemovedVersion) { | ||
230 | return LocallyModifiedVersion; | 230 | return LocallyModifiedVersion; | ||
231 | } | 231 | } | ||
232 | } | 232 | } | ||
233 | ++it; | 233 | ++it; | ||
234 | } | 234 | } | ||
235 | 235 | | |||
236 | return NormalVersion; | 236 | return NormalVersion; | ||
237 | } | 237 | } | ||
Show All 20 Lines | 257 | foreach (const KFileItem& item, items) { | |||
258 | const ItemVersion version = itemVersion(item); | 258 | const ItemVersion version = itemVersion(item); | ||
259 | if (version != UnversionedVersion) { | 259 | if (version != UnversionedVersion) { | ||
260 | ++versionedCount; | 260 | ++versionedCount; | ||
261 | } | 261 | } | ||
262 | 262 | | |||
263 | switch (version) { | 263 | switch (version) { | ||
264 | case LocallyModifiedVersion: | 264 | case LocallyModifiedVersion: | ||
265 | case ConflictingVersion: | 265 | case ConflictingVersion: | ||
266 | case AddedVersion: | ||||
267 | case RemovedVersion: | ||||
266 | ++editingCount; | 268 | ++editingCount; | ||
267 | break; | 269 | break; | ||
268 | default: | 270 | default: | ||
269 | break; | 271 | break; | ||
270 | } | 272 | } | ||
271 | } | 273 | } | ||
272 | m_commitAction->setEnabled(editingCount > 0); | 274 | m_commitAction->setEnabled(editingCount > 0); | ||
273 | m_addAction->setEnabled(versionedCount == 0); | 275 | m_addAction->setEnabled(versionedCount == 0); | ||
▲ Show 20 Lines • Show All 191 Lines • ▼ Show 20 Line(s) | 460 | { | |||
465 | // Only enable the SVN actions if no SVN commands are | 467 | // Only enable the SVN actions if no SVN commands are | ||
466 | // executed currently (see slotOperationCompleted() and | 468 | // executed currently (see slotOperationCompleted() and | ||
467 | // startSvnCommandProcess()). | 469 | // startSvnCommandProcess()). | ||
468 | const bool enabled = !m_pendingOperation; | 470 | const bool enabled = !m_pendingOperation; | ||
469 | m_updateAction->setEnabled(enabled); | 471 | m_updateAction->setEnabled(enabled); | ||
470 | 472 | | |||
471 | const ItemVersion version = itemVersion(directory); | 473 | const ItemVersion version = itemVersion(directory); | ||
472 | m_showLocalChangesAction->setEnabled(enabled && (version != NormalVersion)); | 474 | m_showLocalChangesAction->setEnabled(enabled && (version != NormalVersion)); | ||
473 | m_commitAction->setEnabled(enabled && (version == LocallyModifiedVersion)); | 475 | if (version == LocallyModifiedVersion || version == AddedVersion || version == RemovedVersion) { | ||
476 | m_commitAction->setEnabled(enabled); | ||||
477 | } else { | ||||
478 | m_commitAction->setEnabled(false); | ||||
479 | } | ||||
474 | 480 | | |||
475 | QList<QAction*> actions; | 481 | QList<QAction*> actions; | ||
476 | actions.append(m_updateAction); | 482 | actions.append(m_updateAction); | ||
477 | actions.append(m_showLocalChangesAction); | 483 | actions.append(m_showLocalChangesAction); | ||
478 | actions.append(m_commitAction); | 484 | actions.append(m_commitAction); | ||
479 | actions.append(m_showUpdatesAction); | 485 | actions.append(m_showUpdatesAction); | ||
480 | return actions; | 486 | return actions; | ||
481 | } | 487 | } | ||
482 | 488 | | |||
483 | #include "fileviewsvnplugin.moc" | 489 | #include "fileviewsvnplugin.moc" |