[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: [PATCH] WhatsThis links in KActiveLabels
From: Tim Jansen <tim () tjansen ! de>
Date: 2003-03-30 16:14:12
[Download RAW message or body]
Hi...
I would like to add the attached patch to kdelibs/kdeui/kactivelabel.*.
It adds "What'sThis"/Tooltip link support to KActiveLabel. When the users
click on such a label a tooltip appears, usually with additional information.
In order to create such a link just include a
<a href="whatsthis:This is the text that will be displayed in the
QWhatsThis">More Information</a>
in the text of the KActiveLabel.
Here's a screenshot:
http://www.tjansen.de/krfb/whatsthis.png
The purpose is to create more structure for the instructions in a dialog or
wizard. Especially Desktop Sharing suffers from having far too much text in
the dialogs, but the information is still needed sometimes. Making the texts
shorter and labeling the information increases the probability that the user
actually reads them...
bye...
["kactivelabel-whatsthis.patch" (text/x-diff)]
Index: kdeui/kactivelabel.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdeui/kactivelabel.cpp,v
retrieving revision 1.5
diff -u -3 -p -r1.5 kactivelabel.cpp
--- kdeui/kactivelabel.cpp 29 Mar 2002 04:53:01 -0000 1.5
+++ kdeui/kactivelabel.cpp 30 Mar 2003 16:03:41 -0000
@@ -17,10 +17,13 @@
Boston, MA 02111-1307, USA.
*/
+#include "kactivelabel.h"
+
#include <kapplication.h>
+#include <qregexp.h>
+#include <qwhatsthis.h>
#include <qsimplerichtext.h>
-#include "kactivelabel.h"
KActiveLabel::KActiveLabel(QWidget * parent, const char * name)
: QTextBrowser(parent, name)
@@ -62,6 +65,12 @@ void KActiveLabel::paletteChanged()
void KActiveLabel::openLink(const QString & link)
{
+ QRegExp whatsthis("whatsthis:/*([^/].*)");
+ if (whatsthis.exactMatch(link)) {
+ QWhatsThis::display(whatsthis.cap(1));
+ return;
+ }
+
QStringList args;
args << "exec" << link;
kapp->kdeinitExec("kfmclient", args);
Index: kdeui/kactivelabel.h
===================================================================
RCS file: /home/kde/kdelibs/kdeui/kactivelabel.h,v
retrieving revision 1.5
diff -u -3 -p -r1.5 kactivelabel.h
--- kdeui/kactivelabel.h 1 Aug 2002 11:39:36 -0000 1.5
+++ kdeui/kactivelabel.h 30 Mar 2003 16:03:41 -0000
@@ -26,6 +26,8 @@
class KActiveLabelPrivate;
/**
* Label with support for selection and clickable links.
+ * @ref openLink() the actions that will be taken when the user
+ * clicks on a link.
*
* @author Waldo Bastian (bastian@kde.org)
* @version $Id: kactivelabel.h,v 1.5 2002/08/01 11:39:36 pfeiffer Exp $
@@ -57,7 +59,11 @@ public:
public slots:
/**
- * Opens @p link.
+ * Opens @p link in the default browser.
+ *
+ * If @p link starts with the text "whatsthis:" a @ref QWhatsThis
+ * box will appear and the display the rest of the text. The WhatsThis
+ * functionality is available since KDE 3.2.
*/
virtual void openLink(const QString & link);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic