• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeui
 

tdeui

  • tdeui
kwhatsthismanager.cpp
1 /* This file is part of the KDE Libraries
2  * Copyright (C) 2004 Peter Rockai (mornfall) <mornfall@danill.sk>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this library; see the file COPYING.LIB. If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 #include "kwhatsthismanager_p.h"
20 #include "tqwhatsthis.h"
21 #include <tqvariant.h>
22 #include <kdebug.h>
23 #include <tqtextedit.h>
24 #include <tdelocale.h>
25 #include <tdeapplication.h>
26 
27 KWhatsThisManager *KWhatsThisManager::s_instance = 0;
28 
29 class KWhatsThisUndefined : public TQWhatsThis
30 {
31  public:
32  KWhatsThisUndefined (TQWidget *);
33  TQString text (const TQPoint &);
34  public slots:
35  bool clicked (const TQString &);
36  protected:
37  TQWidget *m_widget;
38 };
39 
40 KWhatsThisUndefined::KWhatsThisUndefined (TQWidget *w)
41  : TQWhatsThis (w)
42 {
43  m_widget = w;
44 }
45 
46 TQString KWhatsThisUndefined::text (const TQPoint &)
47 {
48  if (!m_widget)
49  return "";
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.");
54  TQString parent;
55  if (m_widget -> parentWidget ())
56  parent = TQWhatsThis::textFor (m_widget -> parentWidget ());
57  if (parent != txt)
58  if (! parent . isEmpty ())
59  return parent;
60  return txt;
61 }
62 
63 bool KWhatsThisUndefined::clicked (const TQString& href)
64 {
65  if (href == "submit-whatsthis") {
66  TQWidget *w = m_widget;
67  TQString body;
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");
74  }
75  w = m_widget -> topLevelWidget ();
76  if (w) {
77  dsc . append ("toplevel --> ");
78  dsc . append (w -> name ());
79  dsc . append (TQString (" (") + w -> className () + ")\n");
80  }
81  body . append (dsc);
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);
88  }
89  return TRUE;
90 }
91 
92 void KWhatsThisManager::init ()
93 {
94  if (s_instance)
95  return;
96  s_instance = new KWhatsThisManager;
97 }
98 
99 KWhatsThisManager::KWhatsThisManager ()
100 {
101  // go away...
102  // tqApp -> installEventFilter (this);
103 }
104 
105 bool KWhatsThisManager::eventFilter (TQObject * /*o*/, TQEvent *e)
106 {
107  if (e -> type () == TQEvent::ChildInserted) {
108  TQChildEvent *ce = (TQChildEvent *)e;
109  // kdDebug () << "new qobject:" << ce -> child () << endl;
110  if (ce -> child () -> isWidgetType ()) {
111  TQWidget *w = (TQWidget *) (ce -> child ());
112  // kdDebug () << "new qwidget:" << w << endl;
113  if (TQWhatsThis::textFor (w) . isEmpty ())
114  new KWhatsThisUndefined (w);
115  }
116  }
117  return false;
118 }
119 
120 #include "kwhatsthismanager_p.moc"
121 
tdelocale.h
TDEStdAccel::name
TQString name(StdAccel id)

tdeui

Skip menu "tdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeui

Skip menu "tdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.8.8
This website is maintained by Timothy Pearson.