File indexing completed on 2024-05-05 16:39:04

0001 /* This file is part of the KDE project
0002    Copyright (C) 1998,1999,2000 Carsten Pfeiffer <pfeiffer@kde.org>
0003 
0004    This program is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU General Public
0006    License as published by the Free Software Foundation, version 2.
0007 
0008    This program is distributed in the hope that it will be useful,
0009    but WITHOUT ANY WARRANTY; without even the implied warranty of
0010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0011     General Public License for more details.
0012 
0013    You should have received a copy of the GNU General Public License
0014    along with this program; see the file COPYING.  If not, write to
0015    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0016    Boston, MA 02110-1301, USA.
0017 */
0018 
0019 #include "kuickurlwidget.h"
0020 
0021 #include <KRun>
0022 
0023 #include <QUrl>
0024 
0025 
0026 KuickUrlWidget::KuickUrlWidget(QWidget* parent) : KUrlLabel(parent)
0027 {
0028     connect(this, SIGNAL(leftClickedUrl()), SLOT(run()));
0029     setUseTips(true);
0030 }
0031 
0032 KuickUrlWidget::KuickUrlWidget(const QString& text, QWidget *parent)
0033     : KUrlLabel( parent )
0034 {
0035     setText( text );
0036     connect( this, SIGNAL( leftClickedUrl() ), SLOT( run() ));
0037     setUseTips( true );
0038 }
0039 
0040 void KuickUrlWidget::run()
0041 {
0042     QUrl ku( url() );
0043     if ( ku.isValid() ) {
0044     (void) new KRun( ku, this );
0045     }
0046 }