git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH qgit] Add 'Remote branches' context sub menu

From
MCMarco Costalba <mcostalba@gmail.com>
Date
Feb 4, 2007, 10:02 UTC
Message-ID
<e5bfff550702040202n419ce550sddb920bc2db7ea48@mail.gmail.com>

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@gmail.com>
---
 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
Message 1 of 1 in “Add 'Remote branches' context sub menu”
  1. Add 'Remote branches' context sub menuMarco Costalba, Feb 4, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.