# # # patch "src/view/dialogs/ChangesetBrowser.cpp" # from [a6deafea64b283358322368092d5c40aeea0690b] # to [8431f2c45a29b45f1238abc73d26c06ab09b3f43] # # patch "src/view/dialogs/ChangesetBrowser.h" # from [40c66f9501bb5a9c36cea24f3bd06a18adda37b1] # to [f93a6a0fb3913b9ec516c91424123241aaac28e8] # # patch "src/view/dialogs/DatabaseDialogManager.cpp" # from [c10a551cff23278f9abbec80adc6e6f980dae650] # to [9ac1828a1f748a6f8862388dc99bc853e6d38642] # ============================================================ --- src/view/dialogs/ChangesetBrowser.cpp a6deafea64b283358322368092d5c40aeea0690b +++ src/view/dialogs/ChangesetBrowser.cpp 8431f2c45a29b45f1238abc73d26c06ab09b3f43 @@ -107,13 +107,18 @@ ChangesetBrowser::ChangesetBrowser(QWidg connect( changesets, SIGNAL(contextMenuRequested(const QModelIndexList &, const QPoint &)), - this, SLOT(contextMenuRequested(const QModelIndexList &, const QPoint &)) + this, SLOT(changesetsContextMenuRequested(const QModelIndexList &, const QPoint &)) ); connect( revisionView, SIGNAL(doubleClicked(const QModelIndex &)), - this, SLOT(changeViewDoubleClicked(const QModelIndex &)) + this, SLOT(revisionViewDoubleClicked(const QModelIndex &)) ); + + connect( + revisionView, SIGNAL(contextMenuRequested(const QModelIndexList &, const QPoint &)), + this, SLOT(revisionViewContextMenuRequested(const QModelIndexList &, const QPoint &)) + ); } ChangesetBrowser::~ChangesetBrowser() @@ -219,7 +224,7 @@ void ChangesetBrowser::changesetsDoubleC emit revisionManifest(revIdx.data().toString()); } -void ChangesetBrowser::contextMenuRequested(const QModelIndexList & indexList, const QPoint & pos) +void ChangesetBrowser::changesetsContextMenuRequested(const QModelIndexList & indexList, const QPoint & pos) { if (indexList.size() == 0) return; @@ -260,7 +265,7 @@ void ChangesetBrowser::updateParentsList } } -void ChangesetBrowser::changeViewDoubleClicked(const QModelIndex & index) +void ChangesetBrowser::revisionViewDoubleClicked(const QModelIndex & index) { if (!index.isValid()) return; @@ -288,6 +293,54 @@ void ChangesetBrowser::changeViewDoubleC currentRevision); } +void ChangesetBrowser::revisionViewContextMenuRequested(const QModelIndexList & indexList, const QPoint & pos) +{ + if (indexList.size() == 0) return; + + QModelIndex index = indexList.at(0); + + QMenu menu(this); + QFont activeFont; + activeFont.setBold(true); + + QModelIndex label, path; + if (index.column() == 0) + { + label = index; + path = index.sibling(index.row(), 1); + } + else + if (index.column() == 1) + { + label = index.sibling(index.row(), 0); + path = index; + } + else + I(false); + + + if (label.data().toString() != QObject::tr("Patched")) + return; + + QAction * actShowFileDiff = menu.addAction(tr("Show differences")); + QAction * actAnnotate = menu.addAction(tr("Annotate")); + + actShowFileDiff->setFont(activeFont); + + QAction * act = menu.exec(pos); + if (act == actShowFileDiff) + { + emit diffFile(path.data().toString(), + revisionModel->getCurrentParentRevision(), + currentRevision); + } + else + if (act == actAnnotate) + { + emit annotateFile(currentRevision, path.data().toString()); + } +} + void ChangesetBrowser::closeEvent(QCloseEvent * event) { branchLogModel->stopReading(); ============================================================ --- src/view/dialogs/ChangesetBrowser.h 40c66f9501bb5a9c36cea24f3bd06a18adda37b1 +++ src/view/dialogs/ChangesetBrowser.h f93a6a0fb3913b9ec516c91424123241aaac28e8 @@ -37,6 +37,7 @@ signals: signals: void revisionManifest(const QString &); void diffFile(const QString &, const QString &, const QString &); + void annotateFile(const QString &, const QString &); protected: void closeEvent(QCloseEvent *); @@ -50,8 +51,9 @@ private slots: void readMore(); void readingStopped(); void changesetsDoubleClicked(const QModelIndex &); - void contextMenuRequested(const QModelIndexList &, const QPoint &); - void changeViewDoubleClicked(const QModelIndex &); + void changesetsContextMenuRequested(const QModelIndexList &, const QPoint &); + void revisionViewDoubleClicked(const QModelIndex &); + void revisionViewContextMenuRequested(const QModelIndexList &, const QPoint &); void updateParentsList(); private: ============================================================ --- src/view/dialogs/DatabaseDialogManager.cpp c10a551cff23278f9abbec80adc6e6f980dae650 +++ src/view/dialogs/DatabaseDialogManager.cpp 9ac1828a1f748a6f8862388dc99bc853e6d38642 @@ -87,6 +87,11 @@ void DatabaseDialogManager::showChangese changesetBrowser, SIGNAL(diffFile(const QString &, const QString &, const QString &)), this, SLOT(showFileDiff(const QString &, const QString &, const QString &)) ); + + connect( + changesetBrowser, SIGNAL(annotateFile(const QString &, const QString &)), + this, SLOT(showAnnotation(const QString &, const QString &)) + ); } showDialog(changesetBrowser);