Example #1
0
HelpForm::HelpForm(QWidget *parent) :
    QMainWindow(parent,Qt::FramelessWindowHint),webview(new QMyWebView)
{
    setupUi(this);
    setCentralWidget(webview);
    QWebPage *page = webview->page();
    page->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
    page->setContentEditable(FALSE);
    webview->setContextMenuPolicy(Qt::NoContextMenu);
    connect(page,SIGNAL(linkClicked(QUrl)),SLOT(loadUrl(QUrl)));
    connect(action_back,SIGNAL(triggered()),webview,SLOT(back()));
    connect(action_forward,SIGNAL(triggered()),webview,SLOT(forward()));
    connect(action_refresh,SIGNAL(triggered()),webview,SLOT(reload()));
}
void QgsWebViewWidgetWrapper::initWidget( QWidget* editor )
{
  QWidget* container;

  mLineEdit = qobject_cast<QLineEdit*>( editor );

  if ( mLineEdit )
  {

    QgsFilterLineEdit* fle = qobject_cast<QgsFilterLineEdit*>( mLineEdit );
    if ( fle )
    {
      fle->setNullValue( QSettings().value( "qgis/nullValue", "NULL" ).toString() );
    }

    container = qobject_cast<QWidget*>( mLineEdit->parent() );
  }
  else
  {
    container = editor;
    mLineEdit = container->findChild<QLineEdit*>();
  }

  mButton = container->findChild<QPushButton*>( "FileChooserButton" );
  if ( !mButton )
    mButton = container->findChild<QPushButton*>();

  mWebView = container->findChild<QWebView*>( "EditorWebView" );
  if ( !mWebView )
    mWebView = container->findChild<QWebView*>();

  if ( mWebView )
  {
    mWebView->page()->setNetworkAccessManager( QgsNetworkAccessManager::instance() );
    mWebView->settings()->setAttribute( QWebSettings::LocalContentCanAccessRemoteUrls, true );
    mWebView->settings()->setAttribute( QWebSettings::JavascriptCanOpenWindows, true );
#ifdef QGISDEBUG
    mWebView->settings()->setAttribute( QWebSettings::DeveloperExtrasEnabled, true );
#endif
  }

  if ( mButton )
    connect( mButton, SIGNAL( clicked() ), this, SLOT( selectFileName() ) );

  if ( mLineEdit )
  {
    connect( mLineEdit, SIGNAL( textChanged( QString ) ), this, SLOT( loadUrl( QString ) ) );
    connect( mLineEdit, SIGNAL( textChanged( QString ) ), this, SLOT( valueChanged( QString ) ) );
  }
}
Example #3
0
void LocationBar::urlEnter()
{
    const QUrl url = createUrl();
    const QString urlString = convertUrlToText(url);

    m_completer.closePopup();
    m_webView->setFocus();

    if (urlString != text()) {
        setText(convertUrlToText(url));
    }

    emit loadUrl(url);
}
Example #4
0
void TabBar::mouseReleaseEvent(QMouseEvent *event)
{
    if (event->button() == Qt::MidButton) {
        int index = tabAt(event->pos());
        if (index != -1) {
            emit closeTab(index);
        } else {
            QUrl url(QApplication::clipboard()->text(QClipboard::Selection));
            if (!url.isEmpty() && url.isValid() && !url.scheme().isEmpty())
                emit loadUrl(url, TabWidget::NewTab);
        }
    }

    QTabBar::mouseReleaseEvent(event);
}
Example #5
0
void OutputWindow::initDvizPoll()
{
	QString url = m_url;
	QUrl parser(url);
	QString newUrl = QString("http://%1:%2/poll?slide_id=%3&slide_name=%4")
		.arg(parser.host())
		.arg(parser.port())
		.arg(m_slideId)
		//.arg(QString(QUrl::toPercentEncoding(m_slideName)));
		.arg(m_slideName);

	//qDebug()<< "OutputWindow::initDvizPoll(): url:"<<newUrl;
	m_isDataPoll = true;
	loadUrl(newUrl);
}
Example #6
0
void WebView::dropEvent(QDropEvent *event)
{
    QWebView::dropEvent(event);
    if (!event->isAccepted()
        && event->possibleActions() & Qt::CopyAction) {

        QUrl url;
        if (!event->mimeData()->urls().isEmpty())
            url = event->mimeData()->urls().first();
        if (!url.isValid())
            url = event->mimeData()->text();
        if (url.isValid()) {
            loadUrl(url);
            event->acceptProposedAction();
        }
    }
}
Example #7
0
BookmarkManager::BookmarkManager(QObject *parent)
    : QObject(parent)
    , m_manager(0)
    , m_owner(0)
    , m_actionCollection(new KActionCollection(this))
{
    m_manager = KBookmarkManager::userBookmarksManager();

    connect(m_manager, SIGNAL(changed(QString,QString)), this, SLOT(slotBookmarksChanged()));

    // setup menu
    m_owner = new BookmarkOwner(m_manager, this);
    connect(m_owner, SIGNAL(openUrl(KUrl,Rekonq::OpenType)), this, SIGNAL(openUrl(KUrl,Rekonq::OpenType)));

    // bookmarks loading
    connect(this, SIGNAL(openUrl(KUrl,Rekonq::OpenType)), rApp, SLOT(loadUrl(KUrl,Rekonq::OpenType)));
}
Example #8
0
// Called when we choose a new page via the loaction bar.
void DemoModeMainWindow::slChangeLocation()
{
    Log::debug(QString("DEMO: Changed loaction to %1").arg(mAddressBar->text()).toStdString());
    QUrl url = QUrl(mAddressBar->text());

    // Validate the URL (as in artemis.cpp).
    // TODO: it is not clear whether this is needed, as WebKit seems to do something similar on its own.
    if(url.scheme().isEmpty()){
        url = QUrl("http://" + url.toString());
    }

    if(url.isValid()){
        loadUrl(url);
    }else{
        QMessageBox urlError(this);
        urlError.setText("Error: The URL is invalid.");
        urlError.exec();
    }
}
void GLImageHttpDrawable::initImagePoll()
{
	m_isDataPoll = false;
	
	QString imageUrl = m_url;
	if(m_pollDviz)
	{
		QString newUrl = QString("%1?size=%2x%3")
			.arg(imageUrl)
			.arg((int)rect().width())
			.arg((int)rect().height());
	
		qDebug()<< "GLImageHttpDrawable::initImagePoll(): url:"<<newUrl;
		
		imageUrl = newUrl;
	}
	
	loadUrl(imageUrl);
}
Example #10
0
void WebBrowser::createConnections() {
  connect(m_webView, &WebViewer::messageStatusChangeRequested, this, &WebBrowser::receiveMessageStatusChangeRequest);

  connect(m_txtLocation,SIGNAL(submitted(QString)), this, SLOT(loadUrl(QString)));
  connect(m_webView, SIGNAL(urlChanged(QUrl)), this, SLOT(updateUrl(QUrl)));

  // Connect this WebBrowser to global TabWidget.
  //TabWidget *tab_widget = qApp->mainForm()->tabWidget();
  //connect(m_webView, SIGNAL(newTabRequested()), tab_widget, SLOT(addEmptyBrowser()));
  //connect(m_webView, SIGNAL(linkMiddleClicked(QUrl)), tab_widget, SLOT(addLinkedBrowser(QUrl)));

  // Change location textbox status according to webpage status.
  connect(m_webView, SIGNAL(loadStarted()), this, SLOT(onLoadingStarted()));
  connect(m_webView, SIGNAL(loadProgress(int)), this, SLOT(onLoadingProgress(int)));
  connect(m_webView, SIGNAL(loadFinished(bool)), this, SLOT(onLoadingFinished(bool)));

  // Forward title/icon changes.
  connect(m_webView, SIGNAL(titleChanged(QString)), this, SLOT(onTitleChanged(QString)));
  connect(m_webView, SIGNAL(iconChanged(QIcon)), this, SLOT(onIconChanged(QIcon)));
}
Example #11
0
void OutputWindow::initImagePoll()
{
	m_isDataPoll = false;
	
	QString imageUrl = m_url;
	if(m_pollDviz)
	{
		QString newUrl = QString("%1?size=%2x%3")
			.arg(imageUrl)
			.arg(640)
			.arg(480)
			//.arg((int)rect().width())
			//.arg((int)rect().height())
			;
		
		//qDebug()<< "OutputWindow::initImagePoll(): url:"<<newUrl;
		
		imageUrl = newUrl;
	}
	
	loadUrl(imageUrl);
}
Example #12
0
void LocationCompleter::indexActivated(const QModelIndex &index)
{
    Q_ASSERT(index.isValid());

    const QUrl url = index.data(LocationCompleterModel::UrlRole).toUrl();
    const int tabPos = index.data(LocationCompleterModel::TabPositionTabRole).toInt();

    // Switch to tab with simple index activation
    if (tabPos > -1) {
        BrowserWindow* window = static_cast<BrowserWindow*>(index.data(LocationCompleterModel::TabPositionWindowRole).value<void*>());
        Q_ASSERT(window);
        switchToTab(window, tabPos);
        return;
    }

    if (index.data(LocationCompleterModel::BookmarkRole).toBool()) {
        BookmarkItem* bookmark = static_cast<BookmarkItem*>(index.data(LocationCompleterModel::BookmarkItemRole).value<void*>());
        bookmark->updateVisitCount();
    }

    loadUrl(url);
}
Example #13
0
void BSClient::replyUrlFinished()
{
    qDebug() << "BSClient::replyUrlFinished()";

    QByteArray byteArray = m_reply->readAll();

    if(isCaptcha(byteArray))
    {
        loadUrl(m_urlId);
        return;
    }

    QJsonDocument document = QJsonDocument::fromJson(byteArray);

    if(!document.isObject())
    {
        Q_EMIT error(tr("JSON-Parse-Fehler: 0x002E"));
        return;
    }

    QJsonObject object = document.object();

    if(!object.contains("fullurl"))
    {
        Q_EMIT error(tr("JSON-Parse-Fehler: 0x002F"));
        return;
    }

    QJsonValue value = object.value("fullurl");

    if(!value.isString())
    {
        Q_EMIT error(tr("JSON-Parse-Fehler: 0x0030"));
        return;
    }

    Q_EMIT loadUrlFinished(QUrl(value.toString()));
}
Example #14
0
void RssParser::reloadData()
{
	loadUrl(m_url);
}
Example #15
0
// Called when the ArtemisWebPage receives a request for navigation and we have set it's mAcceptingNavigation flag to false.
// i.e. when we want to intercept the load and pass it to WebkitExecutor instead.
void DemoModeMainWindow::slNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, QWebPage::NavigationType type)
{
    Log::debug(QString("DEMO: Navigation intercepted to %1").arg(request.url().toString()).toStdString());

    loadUrl(request.url());
}
Example #16
0
// Called to start the analysis.
void DemoModeMainWindow::run(const QUrl& url)
{
    Log::debug("CONCOLIC-INFO: Beginning initial page load...");
    loadUrl(url);
}
Example #17
0
void BrowserWidget::goHome() {
    loadUrl(homePageUrl);
}
Example #18
0
void gcWebControl::home()
{
	loadUrl(m_szHomeUrl.c_str());
}
Example #19
0
void WebBrowser::loadUrl(const QString &url) {
  return loadUrl(QUrl::fromUserInput(url));
}
Example #20
0
void MainWindow::open()
{
	const Url openUrl = FileDialog::getOpenUrl(this, tr("Open PGF source file"), m_lastUrl, QLatin1String("text/x-pgf"));
	if (openUrl.isValid() && !openUrl.isEmpty())
		loadUrl(openUrl);
}
Example #21
0
//
// The update method is where the events are processed. It should be
// called after each frame is rendered.
//
bool VrmlScene::update( double timeStamp )
{
  if (timeStamp <= 0.0) timeStamp = theSystem->time();
  VrmlSFTime now( timeStamp );

  d_deltaTime = DEFAULT_DELTA;

  // Update each of the timers.
  VrmlNodeList::iterator i, end = d_timers->end();
  for (i = d_timers->begin(); i != end; ++i)
    {
      VrmlNodeTimeSensor *t = (*i)->toTimeSensor();
      if (t) t->update( now );
    }

  // Update each of the clips.
  end = d_audioClips->end();
  for (i = d_audioClips->begin(); i != end; ++i)
    {
      VrmlNodeAudioClip *c = (*i)->toAudioClip();
      if (c) c->update( now );
    }

  // Update each of the scripts.
  end = d_scripts->end();
  for (i = d_scripts->begin(); i != end; ++i)
    {
      VrmlNodeScript *s = (*i)->toScript();
      if (s) s->update( now );
    }

  // Update each of the movies.
  end = d_movies->end();
  for (i = d_movies->begin(); i != end; ++i)
    {
      VrmlNodeMovieTexture *m =  (*i)->toMovieTexture();
      if (m) m->update( now );
    }


  // Pass along events to their destinations
  while (d_firstEvent != d_lastEvent &&
	 ! d_pendingUrl && ! d_pendingNodes)
    {
      Event *e = &d_eventMem[d_firstEvent];
      d_firstEvent = (d_firstEvent+1) % MAXEVENTS;

      // Ensure that the node is in the scene graph
      VrmlNode *n = e->toNode;
      if (this != n->scene())
	{
	  theSystem->debug("VrmlScene::update: %s::%s is not in the scene graph yet.\n",
			   n->nodeType()->getName(), n->name());
	  n->addToScene((VrmlScene*)this, urlDoc()->url() );
	}
      n->eventIn(e->timeStamp, e->toEventIn, e->value);
      // this needs to change if event values are shared...
      delete e->value;
    }

  if (d_pendingNodes)
    {
      replaceWorld( *d_pendingNodes, d_pendingScope );
      delete d_pendingNodes;
      d_pendingNodes = 0;
      d_pendingScope = 0;
    }
  else if (d_pendingUrl)
    {
      (void) loadUrl( d_pendingUrl, d_pendingParameters );
      delete d_pendingUrl;
      delete d_pendingParameters;
      d_pendingUrl = 0;
      d_pendingParameters = 0;
    }

  // Signal a redisplay if necessary
  return isModified();
}
Example #22
0
void MainWindow::readProperties(const KConfigGroup &group)
{
	const KUrl url(group.readPathEntry(QLatin1String("CurrentUrl"), QString()));
	if (url.isValid() && !url.isEmpty())
		loadUrl(Url(url));
}
Example #23
0
int webPage::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: loading((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 1: isLoading((*reinterpret_cast< QPixmap(*)>(_a[1]))); break;
        case 2: titleChanged((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 3: pageChanged((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 4: showSources((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 5: speedDial(); break;
        case 6: needPrint((*reinterpret_cast< QPrinter*(*)>(_a[1]))); break;
        case 7: openTab((*reinterpret_cast< webPage*(*)>(_a[1]))); break;
        case 8: setFullScreen((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 9: startLoading(); break;
        case 10: finishLoading((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 11: changeTitle((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 12: changeUrl((*reinterpret_cast< QUrl(*)>(_a[1]))); break;
        case 13: goToHome(); break;
        case 14: loadUrl(); break;
        case 15: loadUrl((*reinterpret_cast< QUrl(*)>(_a[1]))); break;
        case 16: loadUrl((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 17: addToBookMark(); break;
        case 18: downloadFile((*reinterpret_cast< const QNetworkRequest(*)>(_a[1]))); break;
        case 19: downloadFile((*reinterpret_cast< QNetworkReply*(*)>(_a[1]))); break;
        case 20: loadBookMark(); break;
        case 21: showBookMark(); break;
        case 22: sources(); break;
        case 23: defineHome(); break;
        case 24: findNext(); break;
        case 25: findPrevious(); break;
        case 26: print(); break;
        case 27: createNewPage((*reinterpret_cast< WebView*(*)>(_a[1]))); break;
        case 28: createNewPage(); break;
        case 29: updateIcon(); break;
        case 30: copy(); break;
        case 31: authentification((*reinterpret_cast< QNetworkReply*(*)>(_a[1])),(*reinterpret_cast< QAuthenticator*(*)>(_a[2]))); break;
        case 32: inspectPage(); break;
        case 33: goToDial(); break;
        case 34: updateUrlIcon((*reinterpret_cast< QPixmap(*)>(_a[1]))); break;
        case 35: updateBookMark(); break;
        case 36: updateOptions(); break;
        case 37: showBar(); break;
        case 38: showPage(); break;
        case 39: showDial(); break;
        case 40: inCache(); break;
        case 41: showConsole(); break;
        case 42: zoomIn(); break;
        case 43: zoomOut(); break;
        case 44: restoreZoom(); break;
        case 45: savePage(); break;
        case 46: back(); break;
        case 47: forward(); break;
        default: ;
        }
        _id -= 48;
    }
    return _id;
}
Example #24
0
void MainWindow::createActions()
{
	// Open
	m_newAction = StandardAction::openNew(this, SLOT(newFile()), this);
	m_openAction = StandardAction::open(this, SLOT(open()), this);
	m_openRecentAction = StandardAction::openRecent(this, SLOT(loadUrl(Url)), this);
	m_saveAction = StandardAction::save(this, SLOT(save()), this);
	m_saveAsAction = StandardAction::saveAs(this, SLOT(saveAs()), this);
	m_reloadAction = new Action(Icon(QLatin1String("view-refresh")), tr("Reloa&d"), this, QLatin1String("file_reload"));
	m_reloadAction->setShortcut(QKeySequence::Refresh);
	m_reloadAction->setStatusTip(tr("Reload the current document"));
	m_reloadAction->setWhatsThis(tr("<p>Reload the current document from disk.</p>"));
	connect(m_reloadAction, SIGNAL(triggered()), this, SLOT(reload()));
	m_closeAction = StandardAction::close(this, SLOT(closeFile()), this);
	m_exitAction = StandardAction::quit(this, SLOT(close()), this);

	m_newAction->setStatusTip(tr("Create a new document"));
	m_openAction->setStatusTip(tr("Open an existing file"));
	m_openRecentAction->setStatusTip(tr("Open a recently opened file"));
	m_saveAction->setStatusTip(tr("Save the current document to disk"));
	m_saveAsAction->setStatusTip(tr("Save the document under a new name"));
	m_closeAction->setStatusTip(tr("Close the current document"));
	m_exitAction->setStatusTip(tr("Exit the application"));

	m_newAction->setWhatsThis(tr("<p>Create a new document.</p>"));
	m_openAction->setWhatsThis(tr("<p>Open an existing file.</p>"));
	m_openRecentAction->setWhatsThis(tr("<p>Open a recently opened file.</p>"));
	m_saveAction->setWhatsThis(tr("<p>Save the current document to disk.</p>"));
	m_saveAsAction->setWhatsThis(tr("<p>Save the document under a new name.</p>"));
	m_closeAction->setWhatsThis(tr("<p>Close the current document.</p>"));
	m_exitAction->setWhatsThis(tr("<p>Exit the application.</p>"));

	// View
	m_buildAction = new Action(Icon(QLatin1String("run-build")), tr("&Build"), this, QLatin1String("build"));
	m_buildAction->setShortcut(tr("Ctrl+B", "View|Build"));
	m_buildAction->setStatusTip(tr("Build preview"));
	m_buildAction->setWhatsThis(tr("<p>Generate preview by building the current TikZ code in the editor.</p>"));
	connect(m_buildAction, SIGNAL(triggered()), m_tikzPreviewController, SLOT(regeneratePreview()));

	m_viewLogAction = new Action(Icon(QLatin1String("run-build-file")), tr("View &Log"), this, QLatin1String("view_log"));
	m_viewLogAction->setStatusTip(tr("View log messages produced by the last executed process"));
	m_viewLogAction->setWhatsThis(tr("<p>Show the log messages produced by the last executed process in the Messages box.</p>"));
	connect(m_viewLogAction, SIGNAL(triggered()), this, SLOT(updateLog()));

	// Configure
	m_configureAction = StandardAction::preferences(this, SLOT(configure()), this);
	m_configureAction->setText(tr("&Configure %1...").arg(KtikzApplication::applicationName()));
	m_configureAction->setStatusTip(tr("Configure the settings of this application"));
	m_configureAction->setWhatsThis(tr("<p>Configure the settings of this application.</p>"));

#ifdef KTIKZ_USE_KDE
	addActionCloneToCollection(QLatin1String("toggle_preview"), m_previewDock->toggleViewAction());
	addActionCloneToCollection(QLatin1String("toggle_log"), m_logDock->toggleViewAction());
#endif

	// Help
	m_showTikzDocAction = new Action(Icon(QLatin1String("help-contents")), tr("TikZ &Manual"), this, QLatin1String("show_tikz_doc"));
	m_showTikzDocAction->setStatusTip(tr("Show the manual of TikZ and PGF"));
	m_showTikzDocAction->setWhatsThis(tr("<p>Show the manual of TikZ and PGF.</p>"));
	connect(m_showTikzDocAction, SIGNAL(triggered()), this, SLOT(showTikzDocumentation()));

#ifdef KTIKZ_USE_KDE
	m_whatsThisAction = KStandardAction::whatsThis(this, SLOT(toggleWhatsThisMode()), this);
#else
	m_helpAction = new QAction(Icon(QLatin1String("help-contents")), tr("%1 &Handbook").arg(KtikzApplication::applicationName()), this);
	m_helpAction->setStatusTip(tr("Show the application's documentation"));
	m_helpAction->setShortcut(QKeySequence::HelpContents);
	connect(m_helpAction, SIGNAL(triggered()), this, SLOT(showDocumentation()));

	m_whatsThisAction = QWhatsThis::createAction(this);
	m_whatsThisAction->setIcon(Icon(QLatin1String("help-contextual")));
	m_whatsThisAction->setStatusTip(tr("Show simple description of any widget"));

	m_aboutAction = new QAction(QIcon(QLatin1String(":/icons/qtikz-22.png")), tr("&About %1").arg(KtikzApplication::applicationName()), this);
	m_aboutAction->setStatusTip(tr("Show the application's About box"));
	connect(m_aboutAction, SIGNAL(triggered()), this, SLOT(about()));

	m_aboutQtAction = new QAction(QIcon(QLatin1String(":/icons/qt-logo-22.png")), tr("About &Qt"), this);
	m_aboutQtAction->setStatusTip(tr("Show the Qt library's About box"));
	connect(m_aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
#endif
}
void UBWebController::onOpenTutorial()
{
    loadUrl(QUrl("http://tutorial.openboard.org"));
}