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

kdeui

  • kdeui
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 <kapplication.h>
23 #include <kglobalsettings.h>
24 #include <ktextbrowser.h>
25 #include <kcursor.h>
26 #include <kurl.h>
27 #include <kiconloader.h>
28 
29 KTextBrowser::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, TQT_SIGNAL(highlighted(const TQString &)),
36  // this, TQT_SLOT(refChanged(const TQString &)));
37 }
38 
39 KTextBrowser::~KTextBrowser( void )
40 {
41 }
42 
43 
44 void KTextBrowser::setNotifyClick( bool notifyClick )
45 {
46  mNotifyClick = notifyClick;
47 }
48 
49 
50 bool KTextBrowser::isNotifyClick() const
51 {
52  return mNotifyClick;
53 }
54 
55 
56 void 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  kapp->invokeMailer( KURL( name ) );
68  }
69  else
70  {
71  emit mailClick( TQString::null, name );
72  }
73  }
74  else
75  {
76  if( !mNotifyClick )
77  {
78  kapp->invokeBrowser( name );
79  }
80  else
81  {
82  emit urlClick( name );
83  }
84  }
85 }
86 
87 
88 void 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 
104 void 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 
113 void KTextBrowser::contentsWheelEvent( TQWheelEvent *e )
114 {
115  if ( KGlobalSettings::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 
121 TQPopupMenu *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("editcopy"), popup->text( popup->idAt(0) ) );
129  else {
130  int id = popup->idAt(0);
131  popup->changeItem( id - IdUndo, SmallIconSet("undo"), popup->text( id - IdUndo) );
132  popup->changeItem( id - IdRedo, SmallIconSet("redo"), popup->text( id - IdRedo) );
133  popup->changeItem( id - IdCut, SmallIconSet("editcut"), popup->text( id - IdCut) );
134  popup->changeItem( id - IdCopy, SmallIconSet("editcopy"), popup->text( id - IdCopy) );
135  popup->changeItem( id - IdPaste, SmallIconSet("editpaste"), popup->text( id - IdPaste) );
136  popup->changeItem( id - IdClear, SmallIconSet("editclear"), popup->text( id - IdClear) );
137  }
138 
139  return popup;
140 }
141 
142 void KTextBrowser::virtual_hook( int, void* )
143 { /*BASE::virtual_hook( id, data );*/ }
144 
145 #include "ktextbrowser.moc"

kdeui

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

kdeui

Skip menu "kdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kdeui by doxygen 1.8.3.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |