{"thread":{"id":"6674","subject":"[PATCH qgit] Add 'Remote branches' context sub menu","startedAt":"2007-02-04T10:02:53Z","lastAt":"2007-02-04T10:02:53Z","messageCount":1,"participants":["Marco Costalba"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"33558","messageId":"e5bfff550702040202n419ce550sddb920bc2db7ea48@mail.gmail.com","threadId":"6674","inReplyTo":null,"subject":"[PATCH qgit] Add 'Remote branches' context sub menu","fromName":"Marco Costalba","fromEmail":"mcostalba@gmail.com","sentAt":"2007-02-04T10:02:53Z","receivedAt":"2007-02-04T10:02:53Z","isPatch":true,"sender":{"key":"mcostalba@gmail.com","avatar":null},"body":"It is now possible to jump to a remote branch from context (right click)\nsub menu in main view.\n\nSigned-off-by: Marco Costalba <mcostalba@gmail.com>\n---\n src/mainimpl.cpp |   22 ++++++++++++++++------\n src/mainimpl.h   |    1 +\n 2 files changed, 17 insertions(+), 6 deletions(-)\n\ndiff --git a/src/mainimpl.cpp b/src/mainimpl.cpp\nindex 694dde5..ead7e0b 100644\n--- a/src/mainimpl.cpp\n+++ b/src/mainimpl.cpp\n@@ -1054,10 +1054,13 @@ void MainImpl::doContexPopup(SCRef sha) {\n \t// global scope because we use a signal/slot connection\n \tdelete contextMenu;\n \tdelete contextSubMenu;\n+\tdelete contextRmtMenu;\n \tcontextMenu = new QPopupMenu(this);\n \tcontextSubMenu = new QPopupMenu(this);\n+\tcontextRmtMenu = new QPopupMenu(this);\n \tconnect(contextMenu, SIGNAL(activated(int)), this,\nSLOT(on_goRef_activated(int)));\n \tconnect(contextSubMenu, SIGNAL(activated(int)), this,\nSLOT(on_goRef_activated(int)));\n+\tconnect(contextRmtMenu, SIGNAL(activated(int)), this,\nSLOT(on_goRef_activated(int)));\n\n \tDomain* t;\n \tint tt = currentTabType(&t);\n@@ -1096,18 +1099,26 @@ void MainImpl::doContexPopup(SCRef sha) {\n \t\t\tActPop->addTo(contextMenu);\n\n \t\tconst QStringList& bn(git->getAllRefNames(Git::BRANCH, Git::optOnlyLoaded));\n+\t\tconst QStringList& rbn(git->getAllRefNames(Git::RMT_BRANCH,\nGit::optOnlyLoaded));\n \t\tconst QStringList& tn(git->getAllRefNames(Git::TAG, Git::optOnlyLoaded));\n-\t\tif (bn.empty() && tn.empty()) {\n+\t\tif (bn.empty() && rbn.empty() && tn.empty()) {\n \t\t\tcontextMenu->exec(QCursor::pos());\n \t\t\treturn;\n \t\t}\n-\t\tint id = 1;\n+\t\tint id = 1; // ref names have id > 0 to disambiguate from actions\n+\t\tif (!rbn.empty()) {\n+\t\t\tQStringList::const_iterator it = rbn.constBegin();\n+\t\t\tfor ( ; it != rbn.constEnd(); ++it, id++)\n+\t\t\t\tcontextRmtMenu->insertItem(*it, id);\n+\t\t}\n+\t\tif (contextRmtMenu->count() > 0)\n+\t\t\tcontextMenu->insertItem(\"Remote branches\", contextRmtMenu);\n+\n \t\tif (!bn.empty()) {\n \t\t\tcontextMenu->insertSeparator();\n \t\t\tQStringList::const_iterator it = bn.constBegin();\n \t\t\tfor ( ; it != bn.constEnd(); ++it, id++) {\n-\t\t\t\t// branch names have id > 0 to disambiguate them from actions,\n-\t\t\t\t// Qt assigns negative id as default\n+\n \t\t\t\tif (id < MAX_MENU_ENTRIES)\n \t\t\t\t\tcontextMenu->insertItem(*it, id);\n \t\t\t\telse\n@@ -1118,8 +1129,7 @@ void MainImpl::doContexPopup(SCRef sha) {\n \t\t\tcontextMenu->insertSeparator();\n \t\t\tQStringList::const_iterator it = tn.constBegin();\n \t\t\tfor ( ; it != tn.constEnd(); ++it, id++) {\n-\t\t\t\t// tag names have id > 0 to disambiguate them from actions,\n-\t\t\t\t// Qt assigns negative id as default\n+\n \t\t\t\tif (id < MAX_MENU_ENTRIES)\n \t\t\t\t\tcontextMenu->insertItem(*it, id);\n \t\t\t\telse\ndiff --git a/src/mainimpl.h b/src/mainimpl.h\nindex e455cb9..4be6ced 100644\n--- a/src/mainimpl.h\n+++ b/src/mainimpl.h\n@@ -151,6 +151,7 @@ private:\n \tQRegExp longLogRE;\n \tQGuardedPtr<QPopupMenu> contextMenu;\n \tQGuardedPtr<QPopupMenu> contextSubMenu;\n+\tQGuardedPtr<QPopupMenu> contextRmtMenu;\n \tQString startUpDir;\n \tQString textToFind;\n \tQFont listViewFont;\n-- \n1.5.0-rc3.GIT\n"}]}