Scribus Developer Documentation - API
logo-pen

Scribus Developer Documentation - API

sctextbrowser.cpp

Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 
00008 #include <QApplication>
00009 #include <QCursor>
00010 #include <QFileDialog>
00011 #include <QFileInfo>
00012 #include <QMessageBox>
00013 #include <QProcess>
00014 #include <QString>
00015 #include <QStringList>
00016 #include <QToolTip>
00017 #include <QUrl>
00018 
00019 #if defined(_WIN32)
00020 #include <windows.h>
00021 #include <shellapi.h>
00022 #endif
00023 
00024 #include "prefsmanager.h"
00025 #include "sctextbrowser.h"
00026 #include "urllauncher.h"
00027 
00028 ScTextBrowser::ScTextBrowser( QWidget * parent )
00029      : QTextBrowser(parent)
00030 {
00031     setOpenLinks(false);
00032     connect(this, SIGNAL(highlighted(const QString &)), this, SLOT(hoverMouse(const QString &)));
00033     connect(this, SIGNAL(anchorClicked(const QUrl &)), this, SLOT(navigateOverride(const QUrl &)));
00034 }
00035 
00036 void ScTextBrowser::hoverMouse(const QString &link)
00037 {
00038     if (link.isEmpty())
00039         qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
00040     else
00041     {
00042         qApp->changeOverrideCursor(QCursor(Qt::PointingHandCursor));
00043 //      Add this back in if we want links to show in tooltips
00044 //      QToolTip::showText(QCursor::pos(), link);
00045     }
00046     emit overLink(link);
00047 }
00048 
00049 void ScTextBrowser::navigateOverride(const QUrl & link)
00050 {
00051     if (link.scheme()=="http")
00052         UrlLauncher::instance()->launchUrlExt(link, parentWidget());
00053     else
00054         setSource(link);
00055 }
Created with personalized Doxygen. This is documentation for GPL software Scribus - Open Source Desktop Publishing.