> I think that is a very good point. However my main concern however is
> how to handle "clean" files. Those are not normally shown on the
> commit widget, while they are shown on the manifest widget...
How about this?
It displays "Show unmodified files" link so that you can easily know
there's a way to show clean files by a single action.
If it sounds good, I'll rewrite this clumsy implementation.
diff --git a/tortoisehg/hgqt/status.py b/tortoisehg/hgqt/status.py
--- a/tortoisehg/hgqt/status.py
+++ b/tortoisehg/hgqt/status.py
@@ -241,7 +241,7 @@ class StatusWidget(QWidget):
if model and model.rowCount(QModelIndex()):
smodel = self.tv.selectionModel()
curidx = smodel.currentIndex()
- if curidx.isValid():
+ if curidx.isValid() and curidx.row() != model.rowCount() - 1:
curpath = model.getRow(curidx)[COL_PATH]
else:
curpath = None
@@ -401,6 +401,10 @@ class StatusWidget(QWidget):
#@pyqtSlot(QModelIndex, QModelIndex)
def onCurrentChange(self, index, old):
'Connected to treeview "currentChanged" signal'
+ if index.row() == self.tv.model().rowCount() - 1:
+ # assume that "show unmodified" link clicked
+ self.statusfilter.setStatus(self.statusfilter.status() + 'C')
+ return
row = index.model().getRow(index)
if row is None:
return
@@ -627,10 +631,10 @@ class WctxModel(QAbstractTableModel):
self.rows = rows
self.checkable = checkable
- def rowCount(self, parent):
+ def rowCount(self, parent=QModelIndex()):
if parent.isValid():
return 0 # no child
- return len(self.rows)
+ return len(self.rows) + 1
def check(self, files, state=True):
for f in files:
@@ -652,6 +656,8 @@ class WctxModel(QAbstractTableModel):
def data(self, index, role):
if not index.isValid():
return QVariant()
+ if index.row() == len(self.rows):
+ return self._epilogueData(index, role)
path, status, mst, upath, ext, sz = self.rows[index.row()]
if index.column() == COL_PATH:
@@ -683,6 +689,23 @@ class WctxModel(QAbstractTableModel):
'''
return QVariant()
+ def _epilogueData(self, index, role):
+ if index.column() != COL_PATH_DISPLAY:
+ return
+ if role == Qt.DisplayRole:
+ # XXX should only be available if 'clean' files are hidden
+ return _('Show unmodified files...')
+ if role == Qt.SizeHintRole:
+ return QSize(80, 30) # XXX just want to increase height
+ # imitate hyper-link style
+ if role == Qt.ForegroundRole:
+ return QBrush(QColor('blue'))
+ if role == Qt.FontRole:
+ font = QFont()
+ font.setItalic(True)
+ font.setUnderline(True)
+ return font
+
def headerData(self, col, orientation, role):
if role != Qt.DisplayRole or orientation != Qt.Horizontal:
return QVariant()
@@ -690,6 +713,8 @@ class WctxModel(QAbstractTableModel):
return QVariant(self.headers[col])
def flags(self, index):
+ if index.row() == len(self.rows):
+ return Qt.ItemIsEnabled
flags = Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsDragEnabled
if index.column() == COL_PATH and self.checkable:
flags |= Qt.ItemIsUserCheckable