Example #1
0
TaskEditor::TaskEditor(QWidget *parent) :
    QWidget(parent){
    setupUi(this);
    this->setAttribute(Qt::WA_DeleteOnClose);
    this->taskCombo->addItem("");
    connect(this->saveButton,SIGNAL(clicked()),this,SLOT(save()));
    QList<Json::Value>*tasks=static_cast <qtMushi *>(qApp)->taskDirectory.getAllTasks();
    for(int x=0;x<tasks->count();x++){
        this->taskCombo->addItem(tasks->at(x).get("title","").asString().c_str(),QVariant(tasks->at(x).get("id","").asCString()));
    }

    QList<Json::Value>*statuses=static_cast <qtMushi *>(qApp)->statusDirectory.getAllStatuses();
    for(int x=0;x<statuses->count();x++){
        this->statusCombo->addItem(statuses->at(x).get("name","").asString().c_str(),QVariant(statuses->at(x).get("id","").asCString()));
    }

    QList<Json::Value>*users=static_cast <qtMushi *>(qApp)->userDirectory.getAllUsers();
    for(int x=0;x<users->count();x++){
        this->ownerCombo->addItem(users->at(x).get("firstName","").asString().append(" ").append(users->at(x).get("lastName","").asString()).c_str(),QVariant(users->at(x).get("id","").asCString()));
    }

    this->connect(this->addNoteButton,SIGNAL(clicked()),this,SLOT(addNote()));
    this->controls->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
    this->connect(this->controls,SIGNAL(linkClicked(QUrl)),this,SLOT(linkClicked(QUrl)));
    this->controls->setTextSizeMultiplier(0.8);


}
Example #2
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow) {
    ui->setupUi(this);

    connect(ui->webView, SIGNAL(linkClicked(QUrl)), this, SLOT(linkClicked(QUrl)));
}
Example #3
0
WebViewHtmlWidget::WebViewHtmlWidget(QObject *parent) :
    IHtmlWidget(parent)
{
    m_widget = new QWebView;
    m_widget->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
    connect(m_widget,SIGNAL(linkClicked(QUrl)),this,SIGNAL(linkClicked(QUrl)));
    connect(m_widget->page(),SIGNAL(linkHovered(QString,QString,QString)),this,SLOT(webLinkHovered(QString,QString,QString)));
    connect(m_widget->page(),SIGNAL(loadFinished(bool)),this,SIGNAL(loadFinished(bool)));
}
BrowserDialog::BrowserDialog(QWidget* parent): QDialog(parent)
    ,m_ui(new Ui::BrowserDialog)
{
    m_ui->setupUi(this);
    m_ui->listWidget->hide();
    setWindowIcon(QIcon::fromTheme("internet-web-browser"));
    setWindowTitle(_("Browse Sogou Cell Dict repository"));

    m_ui->webView->page()->setLinkDelegationPolicy(QWebPage::DelegateExternalLinks);
    connect(m_ui->webView, SIGNAL(loadProgress(int)), m_ui->progressBar, SLOT(setValue(int)));
    connect(m_ui->webView, SIGNAL(loadStarted()), m_ui->progressBar, SLOT(show()));
    connect(m_ui->webView, SIGNAL(loadFinished(bool)), m_ui->progressBar, SLOT(hide()));
    connect(m_ui->webView, SIGNAL(linkClicked(QUrl)), SLOT(linkClicked(QUrl)));
    m_ui->webView->load(QUrl(URL_BASE));
}
Example #5
0
lmcMessageLog::lmcMessageLog(QWidget *parent)
    : QWebView(parent)
{

	connect(this, SIGNAL(linkClicked(QUrl)), this, SLOT(log_linkClicked(QUrl)));
	connect(this->page()->mainFrame(), SIGNAL(contentsSizeChanged(QSize)),
			this, SLOT(log_contentsSizeChanged(QSize)));
	connect(this->page(), SIGNAL(linkHovered(QString, QString, QString)),
			this, SLOT(log_linkHovered(QString, QString, QString)));

	setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
	setRenderHints(QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform);

	createContextMenu();

	participantAvatars.clear();
	hasData = false;
	messageTime = false;
	messageDate = false;
	allowLinks = false;
	pathToLink = false;
	trimMessage = true;
	fontSizeVal = 0;
	sendFileMap.clear();
	receiveFileMap.clear();
	lastId = QString::null;
	messageLog.clear();
	linkHovered = false;
	outStyle = false;
	autoScroll = true;
}
Example #6
0
void MyWebView::initEvents()
{
    // 委托页面所有连接在当前视图中打开
    myPage->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
    connect(myPage, SIGNAL(linkClicked(QUrl)), this, SLOT(onOpenUrl(QUrl)));

    // 对所有事件添加信号槽
    connect(myFrame, SIGNAL(loadFinished(bool)), this, SLOT(onLoadFinished(bool)));
    connect(myFrame, SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(onJavaScriptWindowObjectCleared()));
    connect(myFrame, SIGNAL(initialLayoutCompleted()), this, SLOT(onInitialLayoutCompleted()));
    connect(myFrame, SIGNAL(pageChanged()), this, SLOT(onPageChanged()));
    connect(myFrame, SIGNAL(contentsSizeChanged(const QSize)), this, SLOT(onContentsSizeChanged(const QSize)));
    connect(myFrame, SIGNAL(iconChanged()), this, SLOT(onIconChanged()));
    connect(myFrame, SIGNAL(loadStarted()), this, SLOT(onLoadStarted()));
    connect(myFrame, SIGNAL(titleChanged(const QString)), this, SLOT(onTitleChanged(const QString)));
    connect(myFrame, SIGNAL(urlChanged(const QUrl)), this, SLOT(onUrlChanged(const QUrl)));

    connect(myPage, SIGNAL(loadProgress(int)), this, SLOT(onLoadProgress(int)));
    connect(myPage, SIGNAL(repaintRequested(const QRect)), this, SLOT(onRepaintRequested(const QRect)));
    connect(myPage, SIGNAL(geometryChangeRequested(const QRect)), this, SLOT(onGeometryChangeRequested(const QRect)));

    connect(newManager, SIGNAL(requestFinished(QString)),
            this, SLOT(onRequestFinished(QString)));
    connect(newManager, SIGNAL(requestStart(QString)),
            this, SLOT(onRequestStart(QString)));
};
Example #7
0
Dialog::Dialog(const Application* application, const QString& userId, QWidget* parent) :
    QWidget(parent),
    ui(new Ui::Dialog),
    application(application),
    userId(userId)
{
    unreadInList = QStringList();
    setupUi();

    connect(ui->textEdit
            , SIGNAL(focusIn())
            , this
            , SLOT(markInboxRead()));


    connect(ui->webView->page()->mainFrame()
            , SIGNAL(contentsSizeChanged(QSize))
            , this
            , SLOT(scrollToBottom(QSize)));

    loadHistory(20);

    connect(&application->getLongPollExecutor()
            , SIGNAL(messageRecieved(QString,bool, bool,QString,uint,QString))
            , this
            , SLOT(insertMessage(QString,bool, bool,QString,uint,QString)));
    connect(&application->getLongPollExecutor()
            , SIGNAL(messageIsRead(QString))
            , this
            , SLOT(markMessageIsRead(QString)));
    connect(ui->textEdit, SIGNAL(returnPressed()), this, SLOT(sendMessage()));
    connect(ui->pushButton, SIGNAL(released()), this, SLOT(sendMessage()));
    ui->webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
    connect(ui->webView, SIGNAL(linkClicked(QUrl)), this, SLOT(openAttachment(QUrl)));
}
Example #8
0
void Q3TextBrowser::emitLinkClicked(const QString &s)
{
    d->textOrSourceChanged = false;
    emit linkClicked(s);
    if (!d->textOrSourceChanged)
        setSource(s);
}
Example #9
0
void AboutDialog::show(){
    aboutWebView->load(QUrl("qrc:/webkit-sources/about.html"));
    connect(aboutWebView, SIGNAL(linkClicked(QUrl)), this, SLOT(openLink(QUrl)));
    this->showNormal();
    aboutWebView->resize(this->width(), aboutWebView->height());
    this->adjustSize();
}
Example #10
0
GenericViewer::GenericViewer( QWidget* parent )
    : QMailViewerInterface( parent ),
      browser( new Browser(parent) ),
      message( 0 ),
      plainTextMode( false ),
      containsNumbers( false )
{
    connect(browser, SIGNAL(anchorClicked(QUrl)), this, SLOT(linkClicked(QUrl)));
    connect(browser, SIGNAL(highlighted(QUrl)), this, SLOT(linkHighlighted(QUrl)));
    connect(browser, SIGNAL(finished()), this, SIGNAL(finished()));

    plainTextModeAction = new QAction(QIcon(":icon/txt"), tr("Plain text"), this);
    plainTextModeAction->setVisible(!plainTextMode);
    plainTextModeAction->setWhatsThis(tr("Display the message contents in Plain text format."));

    richTextModeAction = new QAction(QIcon(":icon/txt"), tr("Rich text"), this);
    richTextModeAction->setVisible(plainTextMode);
    richTextModeAction->setWhatsThis(tr("Display the message contents in Rich text format."));

    printAction = new QAction(QIcon(":icon/print"), tr("Print"), this);
    printAction->setVisible(false);
    printAction->setWhatsThis(tr("Print the message contents."));

    dialAction = new QAction(this);
    dialAction->setVisible(false);
}
Example #11
0
ChatView::ChatView(const QByteArray &id, const QString &url, QWidget *parent)
  : WebView(parent)
  , m_loaded(false)
  , m_id(id)
  , m_lastMessage(0)
{
  setPage(new WebPage(this));

  page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);

  setUrl(QUrl(url));
  connect(page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), SLOT(populateJavaScriptWindowObject()));

  setFocusPolicy(Qt::NoFocus);

  connect(ChatCore::settings(), SIGNAL(changed(QString,QVariant)), SLOT(settingsChanged(QString,QVariant)));
  connect(this, SIGNAL(linkClicked(QUrl)), SLOT(openUrl(QUrl)));
  connect(ChatNotify::i(), SIGNAL(notify(Notify)), SLOT(notify(Notify)));

  setAcceptDrops(true);
  setIcons();
  createActions();
  retranslateUi();

  QTimer::singleShot(0, this, SLOT(start()));
}
Example #12
0
HelpDialog::HelpDialog( QWidget* parent)
    : QDialog( parent )
{
    QVBoxLayout* layout = new QVBoxLayout;
    setLayout( layout );

    QTextBrowser* webView = new QTextBrowser( this );
    layout->addWidget( webView );

    const QString text = tr(
        "<h3>Presentation</h3> \
        This application demonstrates some aspects of the KDAB updater component.<br/> \
        Initially you can add target items (<a href=#L4RAction>Line 4 Receiver</a> or <a href=#PSMAction>PSM</a> devices) that use some current firmware version, to the table. <br/> \
        You can see the current compatibility level and firmware version known to the application in the status bar. The source used for finding updates is available when clicking on the button <a href=#SourcesAction>Update Sources</a>.\
        <h3>Step 1: add some items</h3> \
        Add some items to the table, using the <a href=#L4RAction>Add Line 4 Receiver</a> or <a href=#PSMAction>Add PSM</a> button. \
        <h3>Step 2: update the firmware</h3> \
        Update the firmware information by clicking on the <a href=#UpdateAction>Update</a> button : a dialog appears that lets you download and install the version <b>1.1</b> for the package <b>Firmware</b>.<br/> \
        Once that is done, the status bar is updated with the new firmware version.<br/> \
        To update the devices in the table: <a href=#SelectAllAction>select them all</a> and click on the <a href=#UploadAction>Upload Firmwares</a> button. \
        <h3>Step 3: change the compatibility level</h3> \
        The current compatibility level is <b>1</b>. To change that, click on the <a href=#CompatUpdateAction>Update Compat</a> button : a dialog appears that lets you change to a new compat level <b>2</b>, if updates at that level are available.<br/>\
        Once it's done, the status bar is updated with the new compat level and you should see a new column in the table and the application's style changed.\
        <h3>Step 4: update the firmware (one more time)</h3> \
        Now that you changed the compatibility level, you can update the firmware one more time by clicking on the <a href=#UpdateAction>Update</a> button: a dialog appears that lets you install the version <b>2.0</b> for the package <b>Firmware</b><br/> \
        This update wasn't available the first time because it needs the compatibility level <b>2</b>." );

    webView->setHtml( text );
    connect( webView, SIGNAL(linkClicked(QUrl)),
             this, SLOT(clickLink(QUrl)) );

    setWindowTitle( tr("Help FirmwareDemoHttp") );
    resize( 480, 480 );
}
Example #13
0
MainWindow::MainWindow(const QUrl& url)
{
    QNetworkProxyFactory::setUseSystemConfiguration(true);

    view = new QWebView(this);
    connect(view, SIGNAL(linkClicked()), SLOT(updateLocation()));

    locationEdit = new QLineEdit(this);
    locationEdit->setText(url.toString());
    locationEdit->setSizePolicy(QSizePolicy::Expanding, locationEdit->sizePolicy().verticalPolicy());
    connect(locationEdit, SIGNAL(returnPressed()), SLOT(changeLocation()));


    QToolBar *toolBar = addToolBar(tr("Navigation"));
    toolBar->addAction(view->pageAction(QWebPage::Back));
    toolBar->addAction(view->pageAction(QWebPage::Forward));
    toolBar->addAction(view->pageAction(QWebPage::Reload));
    toolBar->addAction(view->pageAction(QWebPage::Stop));
    toolBar->addWidget(locationEdit);

    showFullScreen();
    setCentralWidget(view);
    setUnifiedTitleAndToolBarOnMac(true);

    changeLocation();
}
Example #14
0
void KoHelpView::mouseReleaseEvent( QMouseEvent* e )
{
	if ( ( !currentAnchor.isEmpty() ) && ( currentAnchor == currentText->anchorAt( e->pos() ) ) )
	{
		e->accept();
		if (currentAnchor.startsWith("help://#")) {
			//that's not really useful, since koffice documents can be embedded
			KToolInvocation::invokeHelp(currentAnchor.right(currentAnchor.length()-8));
		}
		else
		if (currentAnchor.startsWith("help://")) {
			// that's the useful version of a help link
			QString helpapp=currentAnchor.right(currentAnchor.length()-7);
			QString helpanchor;
			int pos;
			if ((pos=helpapp.indexOf("#"))!=-1) {
				helpanchor=helpapp.right(helpapp.length()-pos-1);
				helpapp=helpapp.left(pos);
			}
			KToolInvocation::invokeHelp(helpanchor,helpapp);
		}
		else
		emit linkClicked( currentAnchor );
		currentAnchor = "";
	}
	else
		e->ignore();
} // KoHelpView::mouseReleaseEvent
Example #15
0
MainWindow::MainWindow(QWidget *parent)
    : QWebView(parent)
{
    //! The object we will expose to JavaScript engine:
    m_magicbox = new CMagicBox(this);

    // Signal is emitted before frame loads any web content:
    QObject::connect(page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()),
                     this, SLOT(addJSObject()));

    // QWebInspector
    QWebInspector *inspector = new QWebInspector;
    inspector->setPage(page());
    QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
    // context menu
    this->setContextMenuPolicy(Qt::NoContextMenu); //No context menu is allowed if you don't need it

    // Try to handle cicks by self
    page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);//Handle link clicks by yourself
    QObject::connect(page(), SIGNAL( linkClicked( QUrl ) ),
                  this, SLOT( linkClickedSlot( QUrl ) ) );

    // qrc:// URLs refer to resources. See views.qrc
    QUrl startURL = QUrl("qrc:/index.html");
    // Load web content now!
    this->setUrl(startURL);
}
Example #16
0
WebView::WebView( QWidget *parent ) :
  QWebView( parent ),
  _interpretSelection(false)
{
  QtCollider::WebPage *page = new WebPage(this);
  page->setDelegateReload(true);
  setPage( page );

  // Set the style's standard palette to avoid system's palette incoherencies
  // get in the way of rendering web pages
  setPalette( style()->standardPalette() );

  page->action( QWebPage::Copy )->setShortcut( QKeySequence::Copy );
  page->action( QWebPage::Paste )->setShortcut( QKeySequence::Paste );

  connect( this, SIGNAL(linkClicked(QUrl)), this, SLOT(onLinkClicked(QUrl)) );
  connect( page->action(QWebPage::Reload), SIGNAL(triggered(bool)),
           this, SLOT(onPageReload()) );

  connect( this, SIGNAL(interpret(QString)),
           qApp, SLOT(interpret(QString)),
           Qt::QueuedConnection );

  connect( page, SIGNAL(jsConsoleMsg(const QString&, int, const QString&)),
           this, SIGNAL(jsConsoleMsg(const QString&, int, const QString&)) );
}
Example #17
0
FenAide::FenAide(QWidget *parent) : QMainWindow(parent), ui(new Ui::FenAide) {

	ui->setupUi(this);

	webView = new QWebView;

	webView->load(QUrl("qrc:/doc/index.html"));
	webView->setContextMenuPolicy(Qt::NoContextMenu);
	webView->page()->setLinkDelegationPolicy(QWebPage::DelegateExternalLinks);

/*	webView->page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
	QWebInspector *inspector = new QWebInspector;
	inspector->setPage(webView->page());
	inspector->setVisible(true);*/

	setCentralWidget(webView);

	connect(
		webView,
		SIGNAL(linkClicked(QUrl)),
		this,
		SLOT(link_clicked(QUrl))
	);

}
Example #18
0
AWebView::AWebView(DownLoad *download, QWidget *parent)
    : m_downLoad(download)
    , QWebView(parent)
{
    //Network proxy settings, enabled flash plugins
    QNetworkProxyFactory::setUseSystemConfiguration(true);
    QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true);

    //Add Cache
    m_ndCache = new QNetworkDiskCache(this);
    cacheLocation = QDesktopServices::storageLocation(QDesktopServices::CacheLocation);
    m_ndCache->setCacheDirectory(cacheLocation);
    page()->networkAccessManager()->setCache(m_ndCache);

    //WebView signal and slot
    connect(this, SIGNAL(loadProgress(int)), SLOT(viewProgress(int)));
    connect(this, SIGNAL(loadFinished(bool)), SLOT(viewFinished(bool)));

    //The local slot function signal associated with webkit
    connect(page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()),
            this, SLOT(addJavaScriptObject()));

    //Related downloads, here set aside
    connect(m_downLoad, SIGNAL(on_clicked(QString)), this, SLOT(on_linkClicked(QString)));

    //The two link opens the page
    page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
    connect(page(), SIGNAL(linkClicked(QUrl)), this, SLOT(on_linkPage(QUrl)));

    load(QUrl("http://api.83133.com/"));
    //load(QUrl("http://www.999.com/tool"));
}
Example #19
0
void BrowerEditAreaWidget::initSignalsAndSlots()
{
    connect(brower, SIGNAL(linkClicked(QUrl)),
            this, SLOT(openLinkOutside(QUrl)));
    connect(brower->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()),
            this, SLOT(addJavascriptObject()));
}
WebViewMod::WebViewMod(QGraphicsProxyWidget *parent) :
    QGraphicsProxyWidget(parent)
{
    webView = QSharedPointer<QWebView>(new QWebView());
    webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
    connect(webView.data(),SIGNAL(linkClicked(QUrl)),SLOT(handleLinkClicked(QUrl)));
    setWidget(webView.data());
}
Example #21
0
ScTextBrowser::ScTextBrowser( QWidget * parent )
	 : QWebView(parent)
{
	// Questionable - e.g. I would like to browse only through help browser (a pref?)
	page()->setLinkDelegationPolicy(QWebPage::DelegateExternalLinks);
	connect(this, SIGNAL(urlChanged(QUrl)), this, SLOT(catchHome(QUrl)));
	connect(this, SIGNAL(linkClicked(QUrl)), this, SLOT(externalLinkClick(QUrl)));
}
Example #22
0
QWidget* ManPageDocumentation::documentationWidget(KDevelop::DocumentationFindWidget* findWidget, QWidget* parent )
{
    KDevelop::StandardDocumentationView* view = new KDevelop::StandardDocumentationView(findWidget, parent);
    view->setHtml(description());
    view->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
    QObject::connect(view, SIGNAL(linkClicked(QUrl)), ManPageDocumentation::s_provider->model(), SLOT(showItemFromUrl(QUrl)));
    return view;
}
Example #23
0
void Window::show()
{
    settingsWebView = new QWebView();
    settingsWebView->settings()->setAttribute(QWebSettings::JavascriptEnabled, true);
    settingsWebView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
    connect(settingsWebView, SIGNAL(linkClicked(QUrl)), this, SLOT(openLink(QUrl)) );
    settingsWebView->setContextMenuPolicy(Qt::NoContextMenu);
    this->setCentralWidget(settingsWebView);


#ifdef Q_OS_WIN
    settingsWebView->setStyle(QStyleFactory::create("windows"));
#endif

    QUrl syncUrl = QUrl(AGENT_SERVER_URL + portConfigurer->port());

    httpManager->testWebView();

    QNetworkAccessManager * nam = settingsWebView->page()->networkAccessManager();
//    nam->clearAccessCache();
    connect(nam, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), httpManager,
                SLOT(provideAuthentication(QNetworkReply*,QAuthenticator*)));

    settingsWebView->load(syncUrl);

    // link the javascript dialog of the ui to the system FileDialog
    settingsWebView->page()->currentFrame()->addToJavaScriptWindowObject("PydioQtFileDialog", jsDialog);

    QRect rec = QApplication::desktop()->screenGeometry();
    int desktopHeight = rec.height();
    int desktopWidth = rec.width();
    int tray_x = this->tray->geometry().center().x();

    if(desktopHeight < 800){
        this->resize(WIDTH, desktopHeight - 105);
    }
    else{
        this->resize(WIDTH, HEIGHT);
    }
    this->setFixedWidth(WIDTH);
    if(tray->geometry().y() < desktopHeight*0.5)
    {
        // MacOS case
        this->move(tray_x - this->width()/2, tray->geometry().bottom());
    }
    else{
        // Win case
        if(tray_x > (desktopWidth - this->width())/2){
            this->move(desktopWidth - this->width() - WIDTH_OFFSET_WIN, desktopHeight - HEIGHT_OFFSET_WIN - this->height());
        }
        else
            this->move(this->tray->geometry().center().x() - this->width()/2, desktopHeight - 80 - this->height());
    }

    this->raise();
    this->showNormal();
}
Example #24
0
TextBrowserHtmlWidget::TextBrowserHtmlWidget(QObject *parent) :
    IHtmlWidget(parent)
{
    m_widget = new QTextBrowser;
    m_widget->setOpenLinks(false);
    m_widget->setOpenExternalLinks(false);
    connect(m_widget,SIGNAL(anchorClicked(QUrl)),this,SIGNAL(linkClicked(QUrl)));
    connect(m_widget,SIGNAL(highlighted(QUrl)),this,SIGNAL(linkHovered(QUrl)));
}
Example #25
0
void MainWindow::on_urlComboBox_activated(QString value) {
    if(!value.startsWith("http://") &&
       !value.startsWith("https://") &&
       !value.startsWith("file://")) {
        value.prepend("http://");
    }

    linkClicked(QUrl(value));
}
Example #26
0
QgsWelcomePage::QgsWelcomePage( QWidget* parent )
    : QTabWidget( parent )
{
  QVBoxLayout* mainLayout = new QVBoxLayout;
  mainLayout->setMargin( 0 );
  setLayout( mainLayout );

  QHBoxLayout* layout = new QHBoxLayout();
  layout->setMargin( 9 );

  mainLayout->addLayout( layout );

  QWidget* recentProjctsContainer = new QWidget;
  recentProjctsContainer->setLayout( new QVBoxLayout );
  QLabel* recentProjectsTitle = new QLabel( QString( "<h1>%1</h1>" ).arg( tr( "Recent Projects" ) ) );
  recentProjctsContainer->layout()->addWidget( recentProjectsTitle );

  QListView* recentProjectsListView = new QListView();
  mModel = new QgsWelcomePageItemsModel( recentProjectsListView );
  recentProjectsListView->setModel( mModel );
  recentProjectsListView->setItemDelegate( new QgsWelcomePageItemDelegate( recentProjectsListView ) );

  recentProjctsContainer->layout()->addWidget( recentProjectsListView );

  addTab( recentProjctsContainer, "Recent Projects" );

  QWidget* whatsNewContainer = new QWidget;
  whatsNewContainer->setLayout( new QVBoxLayout );
  QLabel* whatsNewTitle = new QLabel( QString( "<h1>%1</h1>" ).arg( tr( "QGIS News" ) ) );
  whatsNewContainer->layout()->addWidget( whatsNewTitle );

  QgsWebView* whatsNewPage = new QgsWebView();
  whatsNewPage->setUrl( QUrl::fromLocalFile( QgsApplication::whatsNewFilePath() ) );
  whatsNewPage->page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks );
  whatsNewPage->setContextMenuPolicy( Qt::NoContextMenu );
  whatsNewPage->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
  whatsNewPage->setStyleSheet( "background:transparent" );
  whatsNewPage->setAttribute( Qt::WA_TranslucentBackground );

  whatsNewContainer->layout()->addWidget( whatsNewPage );
//  whatsNewContainer->setMaximumWidth( 250 );
//  whatsNewContainer->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred );
  addTab( whatsNewContainer, "News" );

  connect( whatsNewPage, SIGNAL( linkClicked( QUrl ) ), this, SLOT( whatsNewLinkClicked( QUrl ) ) );

  mVersionInformation = new QLabel;
  mainLayout->addWidget( mVersionInformation );
  mVersionInformation->setVisible( false );

  mVersionInfo = new QgsVersionInfo();
  connect( mVersionInfo, SIGNAL( versionInfoAvailable() ), this, SLOT( versionInfoReceived() ) );
  mVersionInfo->checkVersion();

  connect( recentProjectsListView, SIGNAL( activated( QModelIndex ) ), this, SLOT( itemActivated( QModelIndex ) ) );
}
Example #27
0
bool WizWebEnginePage::acceptNavigationRequest(const QUrl &url, QWebEnginePage::NavigationType type, bool isMainFrame)
{
    if (NavigationTypeLinkClicked != type)
        return true;
    //
    m_continueNavigate = true;
    emit linkClicked(url, type, isMainFrame, this);

    return m_continueNavigate;
}
Example #28
0
bool LinkFilter::eventFilter(QObject *object, QEvent *event)
{
    if(event->type() == QEvent::WhatsThisClicked)
    {
        QWhatsThisClickedEvent *wtcEvent = static_cast<QWhatsThisClickedEvent*>(event);
        emit linkClicked(wtcEvent->href());
        return true;
    }
    return false;
}
Example #29
0
void Widget::removeClicked(const QString &url)
{
	if(Label *label = qobject_cast<Label*>(sender())) {
		if(!m_timedOut.contains(label)) {
			removeLabel(label);
		}
	}

	emit linkClicked(url);
}
Example #30
0
/*!
    Makes \a page the new web page of the web graphicsitem.

    The parent QObject of the provided page remains the owner
    of the object. If the current document is a child of the web
    view, it will be deleted.

    \sa page()
*/
void QGraphicsWebView::setPage(QWebPage* page)
{
    if (d->page == page)
        return;

    if (d->page) {
        d->page->d->client = 0; // unset the page client
        if (d->page->parent() == this)
            delete d->page;
        else
            d->page->disconnect(this);
    }

    d->page = page;
    if (!d->page)
        return;
    d->page->d->client = d; // set the page client

    QSize size = geometry().size().toSize();
    page->setViewportSize(size);

    QWebFrame* mainFrame = d->page->mainFrame();

    connect(mainFrame, SIGNAL(titleChanged(QString)),
            this, SIGNAL(titleChanged(QString)));
    connect(mainFrame, SIGNAL(iconChanged()),
            this, SIGNAL(iconChanged()));
    connect(mainFrame, SIGNAL(urlChanged(QUrl)),
            this, SIGNAL(urlChanged(QUrl)));
    connect(d->page, SIGNAL(loadStarted()),
            this, SIGNAL(loadStarted()));
    connect(d->page, SIGNAL(loadProgress(int)),
            this, SIGNAL(loadProgress(int)));
    connect(d->page, SIGNAL(loadFinished(bool)),
            this, SLOT(_q_doLoadFinished(bool)));
    connect(d->page, SIGNAL(statusBarMessage(QString)),
            this, SIGNAL(statusBarMessage(QString)));
    connect(d->page, SIGNAL(linkClicked(QUrl)),
            this, SIGNAL(linkClicked(QUrl)));
    connect(d->page, SIGNAL(microFocusChanged()),
            this, SLOT(_q_updateMicroFocus()));
}