Exemple #1
0
void DataMediaWidget::onUrlLoadFailed(const QUrl &AUrl, const XmppError &AError)
{
    if (FUriIndex<FMedia.uris.count() && FMedia.uris.at(FUriIndex).url == AUrl)
    {
        FUriIndex++;
        FLastError = AError;
        loadUri();
    }
}
Exemple #2
0
void DataMediaWidget::onUrlLoaded(const QUrl &AUrl, const QByteArray &AData)
{
    if (FUriIndex<FMedia.uris.count() && FMedia.uris.at(FUriIndex).url == AUrl)
    {
        const IDataMediaURI &uri = FMedia.uris.at(FUriIndex);
        if (!updateWidget(uri, AData))
        {
            FUriIndex++;
            FLastError = XmppError(IERR_DATAFORMS_MEDIA_INVALID_FORMAT);
            loadUri();
        }
    }
}
Exemple #3
0
DataMediaWidget::DataMediaWidget(IDataForms *ADataForms, const IDataMedia &AMedia, QWidget *AParent) : QLabel(AParent)
{
    FMedia = AMedia;
    FDataForms = ADataForms;

    setTextFormat(Qt::PlainText);
    setFrameShape(QLabel::Panel);
    setFrameShadow(QLabel::Sunken);

    connect(FDataForms->instance(),SIGNAL(urlLoaded(const QUrl &, const QByteArray &)),SLOT(onUrlLoaded(const QUrl &, const QByteArray &)));
    connect(FDataForms->instance(),SIGNAL(urlLoadFailed(const QUrl &, const XmppError &)),SLOT(onUrlLoadFailed(const QUrl &, const XmppError &)));

    FUriIndex = 0;
    FLastError = XmppError(IERR_DATAFORMS_MEDIA_INVALID_TYPE);

    QTimer::singleShot(0,this,SLOT(loadUri()));
}
Exemple #4
0
void DataMediaWidget::loadUri()
{
    if (FUriIndex < FMedia.uris.count())
    {
        const IDataMediaURI &uri = FMedia.uris.at(FUriIndex);
        if (FDataForms->isSupportedUri(uri))
        {
            setToolTip(uri.url.toString());
            setText(tr("Loading data..."));
            FDataForms->loadUrl(uri.url);
        }
        else
        {
            FUriIndex++;
            loadUri();
        }
    }
    else
    {
        disconnect(FDataForms->instance());
        setText(FLastError.errorMessage());
        emit mediaError(FLastError);
    }
}
Exemple #5
0
static void goHome(GtkWidget* item, WebKitWebView* webView) {
	gchar *hp = g_object_get_data(G_OBJECT(webView), "homepage");
	loadUri(webView, hp);
}