19 #include "kwhatsthismanager_p.h"
20 #include "tqwhatsthis.h"
21 #include <tqvariant.h>
23 #include <tqtextedit.h>
25 #include <tdeapplication.h>
27 KWhatsThisManager *KWhatsThisManager::s_instance = 0;
29 class KWhatsThisUndefined :
public TQWhatsThis
32 KWhatsThisUndefined (TQWidget *);
33 TQString text (
const TQPoint &);
35 bool clicked (
const TQString &);
40 KWhatsThisUndefined::KWhatsThisUndefined (TQWidget *w)
46 TQString KWhatsThisUndefined::text (
const TQPoint &)
50 TQString txt = i18n (
"<b>Not Defined</b><br>There is no \"What's This?\""
51 " help assigned to this widget. If you want to help us to "
52 " describe the widget, you are welcome to <a href=\"submit"
53 "-whatsthis\">send us your own \"What's This?\" help</a> for it.");
55 if (m_widget -> parentWidget ())
56 parent = TQWhatsThis::textFor (m_widget -> parentWidget ());
58 if (! parent . isEmpty ())
63 bool KWhatsThisUndefined::clicked (
const TQString& href)
65 if (href ==
"submit-whatsthis") {
66 TQWidget *w = m_widget;
68 body . append (
"Widget text: '" + (m_widget -> property (
"text") . toString ()) +
"'\n");
69 TQString dsc = TQString (
"current --> ") + m_widget ->
name ();
70 dsc . append (TQString (
" (") + m_widget -> className () +
")\n");
71 for (w = m_widget; w && w != m_widget -> topLevelWidget (); w = w -> parentWidget ()) {
72 dsc . append (w -> name ());
73 dsc . append (TQString (
" (") + w -> className () +
")\n");
75 w = m_widget -> topLevelWidget ();
77 dsc . append (
"toplevel --> ");
78 dsc . append (w -> name ());
79 dsc . append (TQString (
" (") + w -> className () +
")\n");
82 TQString subj (
"What's This submission: ");
83 subj . append (tqApp -> argv () [0]);
84 body . append (
"\nPlease type in your what's this help between these lines: "
85 "\n--%-----------------------------------------------------------------------\n"
86 "\n--%-----------------------------------------------------------------------");
87 kapp -> invokeMailer (
"quality-whatsthis@kde.org",
"",
"", subj, body);
92 void KWhatsThisManager::init ()
96 s_instance =
new KWhatsThisManager;
99 KWhatsThisManager::KWhatsThisManager ()
105 bool KWhatsThisManager::eventFilter (TQObject * , TQEvent *e)
107 if (e -> type () == TQEvent::ChildInserted) {
108 TQChildEvent *ce = (TQChildEvent *)e;
110 if (ce -> child () -> isWidgetType ()) {
111 TQWidget *w = (TQWidget *) (ce -> child ());
113 if (TQWhatsThis::textFor (w) . isEmpty ())
114 new KWhatsThisUndefined (w);
120 #include "kwhatsthismanager_p.moc"
TQString name(StdAccel id)