It is now possible to jump to a remote branch from context (right click) sub menu in main view. Signed-off-by: Marco Costalba <mcostalba@xxxxxxxxx> --- src/mainimpl.cpp | 22 ++++++++++++++++------ src/mainimpl.h | 1 + 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/mainimpl.cpp b/src/mainimpl.cpp index 694dde5..ead7e0b 100644 --- a/src/mainimpl.cpp +++ b/src/mainimpl.cpp @@ -1054,10 +1054,13 @@ void MainImpl::doContexPopup(SCRef sha) { // global scope because we use a signal/slot connection delete contextMenu; delete contextSubMenu; + delete contextRmtMenu; contextMenu = new QPopupMenu(this); contextSubMenu = new QPopupMenu(this); + contextRmtMenu = new QPopupMenu(this); connect(contextMenu, SIGNAL(activated(int)), this, SLOT(on_goRef_activated(int))); connect(contextSubMenu, SIGNAL(activated(int)), this, SLOT(on_goRef_activated(int))); + connect(contextRmtMenu, SIGNAL(activated(int)), this, SLOT(on_goRef_activated(int))); Domain* t; int tt = currentTabType(&t); @@ -1096,18 +1099,26 @@ void MainImpl::doContexPopup(SCRef sha) { ActPop->addTo(contextMenu); const QStringList& bn(git->getAllRefNames(Git::BRANCH, Git::optOnlyLoaded)); + const QStringList& rbn(git->getAllRefNames(Git::RMT_BRANCH, Git::optOnlyLoaded)); const QStringList& tn(git->getAllRefNames(Git::TAG, Git::optOnlyLoaded)); - if (bn.empty() && tn.empty()) { + if (bn.empty() && rbn.empty() && tn.empty()) { contextMenu->exec(QCursor::pos()); return; } - int id = 1; + int id = 1; // ref names have id > 0 to disambiguate from actions + if (!rbn.empty()) { + QStringList::const_iterator it = rbn.constBegin(); + for ( ; it != rbn.constEnd(); ++it, id++) + contextRmtMenu->insertItem(*it, id); + } + if (contextRmtMenu->count() > 0) + contextMenu->insertItem("Remote branches", contextRmtMenu); + if (!bn.empty()) { contextMenu->insertSeparator(); QStringList::const_iterator it = bn.constBegin(); for ( ; it != bn.constEnd(); ++it, id++) { - // branch names have id > 0 to disambiguate them from actions, - // Qt assigns negative id as default + if (id < MAX_MENU_ENTRIES) contextMenu->insertItem(*it, id); else @@ -1118,8 +1129,7 @@ void MainImpl::doContexPopup(SCRef sha) { contextMenu->insertSeparator(); QStringList::const_iterator it = tn.constBegin(); for ( ; it != tn.constEnd(); ++it, id++) { - // tag names have id > 0 to disambiguate them from actions, - // Qt assigns negative id as default + if (id < MAX_MENU_ENTRIES) contextMenu->insertItem(*it, id); else diff --git a/src/mainimpl.h b/src/mainimpl.h index e455cb9..4be6ced 100644 --- a/src/mainimpl.h +++ b/src/mainimpl.h @@ -151,6 +151,7 @@ private: QRegExp longLogRE; QGuardedPtr<QPopupMenu> contextMenu; QGuardedPtr<QPopupMenu> contextSubMenu; + QGuardedPtr<QPopupMenu> contextRmtMenu; QString startUpDir; QString textToFind; QFont listViewFont; -- 1.5.0-rc3.GIT - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html