7
7
#include < QAction>
8
8
#include < QApplication>
9
9
#include < QCloseEvent>
10
+ #include < QDebug>
10
11
#include < QDesktopWidget>
11
12
#include < QFileDialog>
12
13
#include < QLabel>
@@ -1012,7 +1013,7 @@ ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
1012
1013
: Parent(parent), sym(0 ), _menu(0 )
1013
1014
{
1014
1015
setObjectName (name);
1015
-
1016
+ setOpenLinks ( false );
1016
1017
1017
1018
if (!objectName ().isEmpty ()) {
1018
1019
configSettings->beginGroup (objectName ());
@@ -1085,7 +1086,7 @@ void ConfigInfoView::menuInfo(void)
1085
1086
if (sym->name ) {
1086
1087
head += " (" ;
1087
1088
if (showDebug ())
1088
- head += QString ().sprintf (" <a href=\" s%p \" >" , sym);
1089
+ head += QString ().sprintf (" <a href=\" s%s \" >" , sym-> name );
1089
1090
head += print_filter (sym->name );
1090
1091
if (showDebug ())
1091
1092
head += " </a>" ;
@@ -1094,7 +1095,7 @@ void ConfigInfoView::menuInfo(void)
1094
1095
} else if (sym->name ) {
1095
1096
head += " <big><b>" ;
1096
1097
if (showDebug ())
1097
- head += QString ().sprintf (" <a href=\" s%p \" >" , sym);
1098
+ head += QString ().sprintf (" <a href=\" s%s \" >" , sym-> name );
1098
1099
head += print_filter (sym->name );
1099
1100
if (showDebug ())
1100
1101
head += " </a>" ;
@@ -1145,7 +1146,7 @@ QString ConfigInfoView::debug_info(struct symbol *sym)
1145
1146
switch (prop->type ) {
1146
1147
case P_PROMPT:
1147
1148
case P_MENU:
1148
- debug += QString ().sprintf (" prompt: <a href=\" m%p \" >" , prop-> menu );
1149
+ debug += QString ().sprintf (" prompt: <a href=\" m%s \" >" , sym-> name );
1149
1150
debug += print_filter (prop->text );
1150
1151
debug += " </a><br>" ;
1151
1152
break ;
@@ -1217,13 +1218,74 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char
1217
1218
QString str2 = print_filter (str);
1218
1219
1219
1220
if (sym && sym->name && !(sym->flags & SYMBOL_CONST)) {
1220
- *text += QString ().sprintf (" <a href=\" s%p \" >" , sym);
1221
+ *text += QString ().sprintf (" <a href=\" s%s \" >" , sym-> name );
1221
1222
*text += str2;
1222
1223
*text += " </a>" ;
1223
1224
} else
1224
1225
*text += str2;
1225
1226
}
1226
1227
1228
+ void ConfigInfoView::clicked (const QUrl &url)
1229
+ {
1230
+ QByteArray str = url.toEncoded ();
1231
+ const std::size_t count = str.size ();
1232
+ char *data = new char [count + 1 ];
1233
+ struct symbol **result;
1234
+ struct menu *m = NULL ;
1235
+ char type;
1236
+
1237
+ if (count < 1 ) {
1238
+ qInfo () << " Clicked link is empty" ;
1239
+ delete data;
1240
+ return ;
1241
+ }
1242
+
1243
+ memcpy (data, str.constData (), count);
1244
+ data[count] = ' \0 ' ;
1245
+ type = data[0 ];
1246
+
1247
+ /* Seek for exact match */
1248
+ data[0 ] = ' ^' ;
1249
+ strcat (data, " $" );
1250
+ result = sym_re_search (data);
1251
+ if (!result) {
1252
+ qInfo () << " Clicked symbol is invalid:" << data;
1253
+ delete data;
1254
+ return ;
1255
+ }
1256
+
1257
+ sym = *result;
1258
+ if (type == ' s' ) {
1259
+ symbolInfo ();
1260
+ emit showDebugChanged (true );
1261
+ free (result);
1262
+ delete data;
1263
+ return ;
1264
+ }
1265
+
1266
+ /* URL is a menu */
1267
+ for (struct property *prop = sym->prop ; prop; prop = prop->next ) {
1268
+ if (prop->type != P_PROMPT && prop->type != P_MENU)
1269
+ continue ;
1270
+ m = prop->menu ;
1271
+ break ;
1272
+ }
1273
+
1274
+ if (!m) {
1275
+ qInfo () << " Clicked menu is invalid:" << data;
1276
+ free (result);
1277
+ delete data;
1278
+ return ;
1279
+ }
1280
+
1281
+ _menu = m;
1282
+ menuInfo ();
1283
+
1284
+ emit showDebugChanged (true );
1285
+ free (result);
1286
+ delete data;
1287
+ }
1288
+
1227
1289
QMenu* ConfigInfoView::createStandardContextMenu (const QPoint & pos)
1228
1290
{
1229
1291
QMenu* popup = Parent::createStandardContextMenu (pos);
@@ -1497,6 +1559,9 @@ ConfigMainWindow::ConfigMainWindow(void)
1497
1559
helpMenu->addAction (showIntroAction);
1498
1560
helpMenu->addAction (showAboutAction);
1499
1561
1562
+ connect (helpText, SIGNAL (anchorClicked (const QUrl &)),
1563
+ helpText, SLOT (clicked (const QUrl &)) );
1564
+
1500
1565
connect (configList, SIGNAL (menuChanged (struct menu *)),
1501
1566
helpText, SLOT (setInfo (struct menu *)));
1502
1567
connect (configList, SIGNAL (menuSelected (struct menu *)),
0 commit comments