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

tdeui

  • tdeui
ktextbrowser.cpp
1/* This file is part of the KDE Libraries
2 * Copyright (C) 1999-2000 Espen Sand (espen@kde.org)
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
20
21#include <tqpopupmenu.h>
22#include <tdeapplication.h>
23#include <tdeglobalsettings.h>
24#include <ktextbrowser.h>
25#include <kcursor.h>
26#include <kurl.h>
27#include <kiconloader.h>
28
29KTextBrowser::KTextBrowser( TQWidget *parent, const char *name,
30 bool notifyClick )
31 : TQTextBrowser( parent, name ), mNotifyClick(notifyClick)
32{
33 //
34 //1999-10-04 Espen Sand: Not required anymore ?
35 //connect( this, TQ_SIGNAL(highlighted(const TQString &)),
36 // this, TQ_SLOT(refChanged(const TQString &)));
37}
38
39KTextBrowser::~KTextBrowser( void )
40{
41}
42
43
44void KTextBrowser::setNotifyClick( bool notifyClick )
45{
46 mNotifyClick = notifyClick;
47}
48
49
50bool KTextBrowser::isNotifyClick() const
51{
52 return mNotifyClick;
53}
54
55
56void KTextBrowser::setSource( const TQString& name )
57{
58 if( name.isNull() )
59 {
60 return;
61 }
62
63 if( name.find('@') > -1 )
64 {
65 if( !mNotifyClick )
66 {
67 tdeApp->invokeMailer( KURL( name ) );
68 }
69 else
70 {
71 emit mailClick( TQString::null, name );
72 }
73 }
74 else
75 {
76 if( !mNotifyClick )
77 {
78 tdeApp->invokeBrowser( name );
79 }
80 else
81 {
82 emit urlClick( name );
83 }
84 }
85}
86
87
88void KTextBrowser::keyPressEvent(TQKeyEvent *e)
89{
90 if( e->key() == Key_Escape )
91 {
92 e->ignore();
93 }
94 else if( e->key() == Key_F1 )
95 {
96 e->ignore();
97 }
98 else
99 {
100 TQTextBrowser::keyPressEvent(e);
101 }
102}
103
104void KTextBrowser::viewportMouseMoveEvent( TQMouseEvent* e)
105{
106 // do this first so we get the right type of cursor
107 TQTextBrowser::viewportMouseMoveEvent(e);
108
109 if ( viewport()->cursor().shape() == PointingHandCursor )
110 viewport()->setCursor( KCursor::handCursor() );
111}
112
113void KTextBrowser::contentsWheelEvent( TQWheelEvent *e )
114{
115 if ( TDEGlobalSettings::wheelMouseZooms() )
116 TQTextBrowser::contentsWheelEvent( e );
117 else // thanks, we don't want to zoom, so skip QTextEdit's impl.
118 TQScrollView::contentsWheelEvent( e );
119}
120
121TQPopupMenu *KTextBrowser::createPopupMenu( const TQPoint & pos )
122{
123 enum { IdUndo, IdRedo, IdSep1, IdCut, IdCopy, IdPaste, IdClear, IdSep2, IdSelectAll };
124
125 TQPopupMenu *popup = TQTextBrowser::createPopupMenu( pos );
126
127 if ( isReadOnly() )
128 popup->changeItem( popup->idAt(0), SmallIconSet("edit-copy"), popup->text( popup->idAt(0) ) );
129 else {
130 int id = popup->idAt(0);
131 popup->changeItem( id - IdUndo, SmallIconSet("edit-undo"), popup->text( id - IdUndo) );
132 popup->changeItem( id - IdRedo, SmallIconSet("edit-redo"), popup->text( id - IdRedo) );
133 popup->changeItem( id - IdCut, SmallIconSet("edit-cut"), popup->text( id - IdCut) );
134 popup->changeItem( id - IdCopy, SmallIconSet("edit-copy"), popup->text( id - IdCopy) );
135 popup->changeItem( id - IdPaste, SmallIconSet("edit-paste"), popup->text( id - IdPaste) );
136 popup->changeItem( id - IdClear, SmallIconSet("edit-clear"), popup->text( id - IdClear) );
137 }
138
139 return popup;
140}
141
142void KTextBrowser::virtual_hook( int, void* )
143{ /*BASE::virtual_hook( id, data );*/ }
144
145#include "ktextbrowser.moc"
KCursor::handCursor
static TQCursor handCursor()
Returns the proper hand cursor according to the current GUI style (static function).
Definition: kcursor.cpp:43
KTextBrowser::keyPressEvent
virtual void keyPressEvent(TQKeyEvent *e)
Makes sure Key_Escape is ignored.
Definition: ktextbrowser.cpp:88
KTextBrowser::contentsWheelEvent
virtual void contentsWheelEvent(TQWheelEvent *e)
Reimplemented to support Qt2 behavior (Ctrl-Wheel = fast scroll)
Definition: ktextbrowser.cpp:113
KTextBrowser::KTextBrowser
KTextBrowser(TQWidget *parent=0, const char *name=0, bool notifyClick=false)
Constructor.
Definition: ktextbrowser.cpp:29
KTextBrowser::viewportMouseMoveEvent
virtual void viewportMouseMoveEvent(TQMouseEvent *e)
Make sure we use our own hand cursor.
Definition: ktextbrowser.cpp:104
KTextBrowser::setNotifyClick
void setNotifyClick(bool notifyClick)
Decide whether a click on a link should be handled internally or if a signal should be emitted.
Definition: ktextbrowser.cpp:44
KTextBrowser::setSource
void setSource(const TQString &name)
Reimplemented to NOT set the source but to do the special handling.
Definition: ktextbrowser.cpp:56
KTextBrowser::~KTextBrowser
~KTextBrowser(void)
Destructor.
Definition: ktextbrowser.cpp:39
KTextBrowser::isNotifyClick
bool isNotifyClick() const
Returns whether a click on a link should be handled internally or if a signal should be emitted.
Definition: ktextbrowser.cpp:50
KTextBrowser::createPopupMenu
virtual TQPopupMenu * createPopupMenu(const TQPoint &pos)
Re-implemented for internal reasons.
Definition: ktextbrowser.cpp:121
KTextBrowser::urlClick
void urlClick(const TQString &url)
Emitted if mailClick() is not emitted and the widget has been configured to emit the signal.
KTextBrowser::mailClick
void mailClick(const TQString &name, const TQString &address)
Emitted when a mail link has been activated and the widget has been configured to emit the signal.
KURL
TDEGlobalSettings::wheelMouseZooms
static bool wheelMouseZooms()

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
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.9.4
This website is maintained by Timothy Pearson.