linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Maxim Levitsky <mlevitsk@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Search function in xconfig is partially broken after recent changes
Date: Sun, 28 Jun 2020 13:56:32 +0200	[thread overview]
Message-ID: <20200628135632.198e0083@coco.lan> (raw)
In-Reply-To: <004fa015321d2e612c99eb9ba7954da8023816b7.camel@redhat.com>

Em Sun, 28 Jun 2020 14:20:41 +0300
Maxim Levitsky <mlevitsk@redhat.com> escreveu:

> > But this is not happening. Perhaps this also broke with the Qt5
> > conversion?
> > 
> > I suspect it should, instead, use a different signal to handle it.
> > 
> > See, with the enclosed patch, clicking on a link will now show:
> > 
> > 	Clicked on URL QUrl("s0x21c3f10")
> > 	QTextBrowser: No document for s0x21c3f10
> > 
> > Which helps to explain what's happening here.
> > 
> > See, when debug is turned on, it will create hyperlinks like:
> > 
> > 	head += QString().sprintf("<a href=\"s%p\">", sym);
> > 
> > It seems that the code needs something like:
> > 
> > 	connect (helpText, SIGNAL (anchorClicked (const QUrl &)),
> > 			 helpText, SLOT (clicked (const QUrl &)) );
> > 
> > and a handler for this signal that would translate "s%p"
> > back into sym, using such value to update the menus.
> > 
> > Do you know if this used to work after Kernel 3.14?  
> 
> I don't know yet, but I can test it. 
> 
> I didn't do much kernel developement for lot of time, so I only vaguely
> remember that once upon a time it did work. I don't use this feature much,
> so it might as well be broken back when conversion to Qt5 happened.
> Also worth noting that I probably used Qt4 untill recently when I updated
> to fedora 31, which looks like dropped Qt4 developement packages.
> 
> I used to know a thing or two about Qt, long long ago, so on next weekend or so,
> I can also take a look at this.

Yeah, I suspect you probably tried it before the Qt5 conversion
patches then.

The enclosed patch is one step further fixing this bug. It still
needs to implement the part of the code which starts using the
selected menu or item.

The first hunk won't apply cleanly, because I added a patch
before it, in order to sort out the include mess, but solving
the conflict is trivial (just add an include for QDebug).

Thanks,
Mauro

diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 631e19659504..b989b6543d7a 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -7,6 +7,7 @@
 #include <QAction>
 #include <QApplication>
 #include <QCloseEvent>
+#include <QDebug>
 #include <QDesktopWidget>
 #include <QFileDialog>
 #include <QLabel>
@@ -1012,7 +1013,7 @@ ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
 	: Parent(parent), sym(0), _menu(0)
 {
 	setObjectName(name);
-
+	setOpenLinks(false);
 
 	if (!objectName().isEmpty()) {
 		configSettings->beginGroup(objectName());
@@ -1224,6 +1225,36 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char
 		*text += str2;
 }
 
+void ConfigInfoView::clicked(const QUrl &url)
+{
+	QByteArray str = url.toEncoded();
+	const std::size_t count = str.size();
+	char *hex = new char[count];
+	unsigned long p;
+	struct symbol *sym;
+	struct menu *menu;
+
+	if (count < 1)
+		return;
+
+	memcpy(hex, str.constData(), count);
+	p = (int)strtol(hex + 1, NULL, 16);
+
+	if (!p)
+		return;
+
+	qInfo() << "Clicked on URL" << url;
+
+	if (hex[0] == 's') {
+		sym = (struct symbol *)p;
+
+		qInfo() << "symbol name:" << sym->name;
+	} else {
+		menu = (struct menu *)p;
+		qInfo() << "menu:" << qgettext(menu_get_prompt(menu));
+	}
+}
+
 QMenu* ConfigInfoView::createStandardContextMenu(const QPoint & pos)
 {
 	QMenu* popup = Parent::createStandardContextMenu(pos);
@@ -1497,6 +1528,9 @@ ConfigMainWindow::ConfigMainWindow(void)
 	helpMenu->addAction(showIntroAction);
 	helpMenu->addAction(showAboutAction);
 
+	connect (helpText, SIGNAL (anchorClicked (const QUrl &)),
+		 helpText, SLOT (clicked (const QUrl &)) );
+
 	connect(configList, SIGNAL(menuChanged(struct menu *)),
 		helpText, SLOT(setInfo(struct menu *)));
 	connect(configList, SIGNAL(menuSelected(struct menu *)),
@@ -1601,6 +1635,9 @@ void ConfigMainWindow::searchConfig(void)
 
 void ConfigMainWindow::changeItens(struct menu *menu)
 {
+	if (menu->flags & MENU_ROOT)
+		qInfo() << "Wrong type when changing item";
+
 	configList->setRootMenu(menu);
 
 	if (configList->rootEntry->parent == &rootmenu)
@@ -1611,6 +1648,9 @@ void ConfigMainWindow::changeItens(struct menu *menu)
 
 void ConfigMainWindow::changeMenu(struct menu *menu)
 {
+	if (!(menu->flags & MENU_ROOT))
+		qInfo() << "Wrong type when changing menu";
+
 	menuList->setRootMenu(menu);
 
 	if (menuList->rootEntry->parent == &rootmenu)
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index d913a02967ae..a193137f2314 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -250,6 +250,7 @@ public slots:
 	void setInfo(struct menu *menu);
 	void saveSettings(void);
 	void setShowDebug(bool);
+	void clicked (const QUrl &url);
 
 signals:
 	void showDebugChanged(bool);

  reply	other threads:[~2020-06-28 11:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-25  9:25 Search function in xconfig is partially broken after recent changes Maxim Levitsky
2020-06-25 10:59 ` Mauro Carvalho Chehab
2020-06-25 11:17   ` Mauro Carvalho Chehab
2020-06-25 12:53     ` Maxim Levitsky
2020-06-25 15:05       ` Mauro Carvalho Chehab
2020-06-28  8:37         ` Maxim Levitsky
2020-06-28 10:54           ` Mauro Carvalho Chehab
2020-06-28 11:20             ` Maxim Levitsky
2020-06-28 11:56               ` Mauro Carvalho Chehab [this message]
2020-06-25 13:42   ` Mauro Carvalho Chehab
2020-06-25 14:52     ` [PATCH] kconfig: qconf: Fix find on split mode Mauro Carvalho Chehab
2020-06-28  2:17       ` Masahiro Yamada
2020-06-28  8:40       ` Maxim Levitsky
2020-06-28 14:42         ` Masahiro Yamada
2020-06-30  3:53           ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200628135632.198e0083@coco.lan \
    --to=mchehab+huawei@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mlevitsk@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).