00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
#include <kapplication.h>
00022
#include <kglobalsettings.h>
00023
#include <ktextbrowser.h>
00024
#include <kcursor.h>
00025
#include <kurl.h>
00026
00027 KTextBrowser::KTextBrowser(
QWidget *parent,
const char *name,
00028
bool notifyClick )
00029 :
QTextBrowser( parent, name ), mNotifyClick(notifyClick)
00030 {
00031
00032
00033
00034
00035 }
00036
00037 KTextBrowser::~KTextBrowser(
void )
00038 {
00039 }
00040
00041
00042 void KTextBrowser::setNotifyClick(
bool notifyClick )
00043 {
00044 mNotifyClick = notifyClick;
00045 }
00046
00047
00048 bool KTextBrowser::isNotifyClick()
const
00049
{
00050
return mNotifyClick;
00051 }
00052
00053
00054 void KTextBrowser::setSource(
const QString& name )
00055 {
00056
if( name.
isNull() ==
true )
00057 {
00058
return;
00059 }
00060
00061
if( name.
contains(
'@') ==
true )
00062 {
00063
if( mNotifyClick ==
false )
00064 {
00065 kapp->invokeMailer(
KURL( name ) );
00066 }
00067
else
00068 {
00069 emit
mailClick( QString::null, name );
00070 }
00071 }
00072
else
00073 {
00074
if( mNotifyClick ==
false )
00075 {
00076 kapp->invokeBrowser( name );
00077 }
00078
else
00079 {
00080 emit
urlClick( name );
00081 }
00082 }
00083 }
00084
00085
00086 void KTextBrowser::keyPressEvent(
QKeyEvent *e)
00087 {
00088
if( e->
key() == Key_Escape )
00089 {
00090 e->
ignore();
00091 }
00092
else if( e->
key() == Key_F1 )
00093 {
00094 e->
ignore();
00095 }
00096
else
00097 {
00098 QTextBrowser::keyPressEvent(e);
00099 }
00100 }
00101
00102 void KTextBrowser::viewportMouseMoveEvent(
QMouseEvent* e)
00103 {
00104
00105 QTextBrowser::viewportMouseMoveEvent(e);
00106
00107
if ( viewport()->cursor().shape() == PointingHandCursor )
00108 viewport()->setCursor( KCursor::handCursor() );
00109 }
00110
00111 void KTextBrowser::contentsWheelEvent(
QWheelEvent *e )
00112 {
00113
if (
KGlobalSettings::wheelMouseZooms() )
00114 QTextBrowser::contentsWheelEvent( e );
00115
else
00116 QScrollView::contentsWheelEvent( e );
00117 }
00118
00119
void KTextBrowser::virtual_hook(
int,
void* )
00120 { }
00121
00122
#include "ktextbrowser.moc"