bool TestRunner::secureEventInputIsEnabled() const { WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SecureEventInputIsEnabled")); WKTypeRef returnData = 0; WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()->page(), messageName.get(), 0, &returnData); return WKBooleanGetValue(static_cast<WKBooleanRef>(returnData)); }
void InjectedBundle::queueForwardNavigation(unsigned howFarForward) { m_useWorkQueue = true; WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("QueueForwardNavigation")); WKRetainPtr<WKUInt64Ref> messageBody(AdoptWK, WKUInt64Create(howFarForward)); WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get()); }
void TestRunner::setAlwaysAcceptCookies(bool accept) { WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetAlwaysAcceptCookies")); WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(accept)); WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), 0); }
void InjectedBundle::outputText(const String& output) { if (m_state != Testing) return; if (output.isEmpty()) return; WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("TextOutput")); WKRetainPtr<WKStringRef> messageBody(AdoptWK, WKStringCreateWithUTF8CString(output.utf8().data())); WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get()); }
void InjectedBundle::setHidden(bool hidden) { WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetHidden")); WKRetainPtr<WKMutableDictionaryRef> messageBody(AdoptWK, WKMutableDictionaryCreate()); WKRetainPtr<WKStringRef> isInitialKeyWK(AdoptWK, WKStringCreateWithUTF8CString("hidden")); WKRetainPtr<WKBooleanRef> isInitialWK(AdoptWK, WKBooleanCreate(hidden)); WKDictionarySetItem(messageBody.get(), isInitialKeyWK.get(), isInitialWK.get()); WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get()); }
bool InjectedBundle::shouldProcessWorkQueue() const { if (!m_useWorkQueue) return false; WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("IsWorkQueueEmpty")); WKTypeRef resultToPass = 0; WKBundlePostSynchronousMessage(m_bundle, messageName.get(), 0, &resultToPass); WKRetainPtr<WKBooleanRef> isEmpty(AdoptWK, static_cast<WKBooleanRef>(resultToPass)); return !WKBooleanGetValue(isEmpty.get()); }
void InjectedBundle::setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed) { WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetMockGeolocationPosition")); WKRetainPtr<WKMutableDictionaryRef> messageBody(AdoptWK, WKMutableDictionaryCreate()); WKRetainPtr<WKStringRef> latitudeKeyWK(AdoptWK, WKStringCreateWithUTF8CString("latitude")); WKRetainPtr<WKDoubleRef> latitudeWK(AdoptWK, WKDoubleCreate(latitude)); WKDictionarySetItem(messageBody.get(), latitudeKeyWK.get(), latitudeWK.get()); WKRetainPtr<WKStringRef> longitudeKeyWK(AdoptWK, WKStringCreateWithUTF8CString("longitude")); WKRetainPtr<WKDoubleRef> longitudeWK(AdoptWK, WKDoubleCreate(longitude)); WKDictionarySetItem(messageBody.get(), longitudeKeyWK.get(), longitudeWK.get()); WKRetainPtr<WKStringRef> accuracyKeyWK(AdoptWK, WKStringCreateWithUTF8CString("accuracy")); WKRetainPtr<WKDoubleRef> accuracyWK(AdoptWK, WKDoubleCreate(accuracy)); WKDictionarySetItem(messageBody.get(), accuracyKeyWK.get(), accuracyWK.get()); WKRetainPtr<WKStringRef> providesAltitudeKeyWK(AdoptWK, WKStringCreateWithUTF8CString("providesAltitude")); WKRetainPtr<WKBooleanRef> providesAltitudeWK(AdoptWK, WKBooleanCreate(providesAltitude)); WKDictionarySetItem(messageBody.get(), providesAltitudeKeyWK.get(), providesAltitudeWK.get()); WKRetainPtr<WKStringRef> altitudeKeyWK(AdoptWK, WKStringCreateWithUTF8CString("altitude")); WKRetainPtr<WKDoubleRef> altitudeWK(AdoptWK, WKDoubleCreate(altitude)); WKDictionarySetItem(messageBody.get(), altitudeKeyWK.get(), altitudeWK.get()); WKRetainPtr<WKStringRef> providesAltitudeAccuracyKeyWK(AdoptWK, WKStringCreateWithUTF8CString("providesAltitudeAccuracy")); WKRetainPtr<WKBooleanRef> providesAltitudeAccuracyWK(AdoptWK, WKBooleanCreate(providesAltitudeAccuracy)); WKDictionarySetItem(messageBody.get(), providesAltitudeAccuracyKeyWK.get(), providesAltitudeAccuracyWK.get()); WKRetainPtr<WKStringRef> altitudeAccuracyKeyWK(AdoptWK, WKStringCreateWithUTF8CString("altitudeAccuracy")); WKRetainPtr<WKDoubleRef> altitudeAccuracyWK(AdoptWK, WKDoubleCreate(altitudeAccuracy)); WKDictionarySetItem(messageBody.get(), altitudeAccuracyKeyWK.get(), altitudeAccuracyWK.get()); WKRetainPtr<WKStringRef> providesHeadingKeyWK(AdoptWK, WKStringCreateWithUTF8CString("providesHeading")); WKRetainPtr<WKBooleanRef> providesHeadingWK(AdoptWK, WKBooleanCreate(providesHeading)); WKDictionarySetItem(messageBody.get(), providesHeadingKeyWK.get(), providesHeadingWK.get()); WKRetainPtr<WKStringRef> headingKeyWK(AdoptWK, WKStringCreateWithUTF8CString("heading")); WKRetainPtr<WKDoubleRef> headingWK(AdoptWK, WKDoubleCreate(heading)); WKDictionarySetItem(messageBody.get(), headingKeyWK.get(), headingWK.get()); WKRetainPtr<WKStringRef> providesSpeedKeyWK(AdoptWK, WKStringCreateWithUTF8CString("providesSpeed")); WKRetainPtr<WKBooleanRef> providesSpeedWK(AdoptWK, WKBooleanCreate(providesSpeed)); WKDictionarySetItem(messageBody.get(), providesSpeedKeyWK.get(), providesSpeedWK.get()); WKRetainPtr<WKStringRef> speedKeyWK(AdoptWK, WKStringCreateWithUTF8CString("speed")); WKRetainPtr<WKDoubleRef> speedWK(AdoptWK, WKDoubleCreate(speed)); WKDictionarySetItem(messageBody.get(), speedKeyWK.get(), speedWK.get()); WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get()); }
void InjectedBundle::setVisibilityState(WKPageVisibilityState visibilityState, bool isInitialState) { WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetVisibilityState")); WKRetainPtr<WKMutableDictionaryRef> messageBody(AdoptWK, WKMutableDictionaryCreate()); WKRetainPtr<WKStringRef> visibilityStateKeyWK(AdoptWK, WKStringCreateWithUTF8CString("visibilityState")); WKRetainPtr<WKUInt64Ref> visibilityStateWK(AdoptWK, WKUInt64Create(visibilityState)); WKDictionaryAddItem(messageBody.get(), visibilityStateKeyWK.get(), visibilityStateWK.get()); WKRetainPtr<WKStringRef> isInitialKeyWK(AdoptWK, WKStringCreateWithUTF8CString("isInitialState")); WKRetainPtr<WKBooleanRef> isInitialWK(AdoptWK, WKBooleanCreate(isInitialState)); WKDictionaryAddItem(messageBody.get(), isInitialKeyWK.get(), isInitialWK.get()); WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get()); }
void InjectedBundle::setCustomPolicyDelegate(bool enabled, bool permissive) { WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetCustomPolicyDelegate")); WKRetainPtr<WKMutableDictionaryRef> messageBody(AdoptWK, WKMutableDictionaryCreate()); WKRetainPtr<WKStringRef> enabledKeyWK(AdoptWK, WKStringCreateWithUTF8CString("enabled")); WKRetainPtr<WKBooleanRef> enabledWK(AdoptWK, WKBooleanCreate(enabled)); WKDictionarySetItem(messageBody.get(), enabledKeyWK.get(), enabledWK.get()); WKRetainPtr<WKStringRef> permissiveKeyWK(AdoptWK, WKStringCreateWithUTF8CString("permissive")); WKRetainPtr<WKBooleanRef> permissiveWK(AdoptWK, WKBooleanCreate(permissive)); WKDictionarySetItem(messageBody.get(), permissiveKeyWK.get(), permissiveWK.get()); WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get()); }
void InjectedBundle::queueLoad(WKStringRef url, WKStringRef target) { m_useWorkQueue = true; WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("QueueLoad")); WKRetainPtr<WKMutableDictionaryRef> loadData(AdoptWK, WKMutableDictionaryCreate()); WKRetainPtr<WKStringRef> urlKey(AdoptWK, WKStringCreateWithUTF8CString("url")); WKDictionarySetItem(loadData.get(), urlKey.get(), url); WKRetainPtr<WKStringRef> targetKey(AdoptWK, WKStringCreateWithUTF8CString("target")); WKDictionarySetItem(loadData.get(), targetKey.get(), target); WKBundlePostMessage(m_bundle, messageName.get(), loadData.get()); }
void GxsFeedItem::copyMessageLink() { if (groupId().isNull() || mMessageId.isNull()) { return; } if (getLinkType() == RetroShareLink::TYPE_UNKNOWN) { return; } RetroShareLink link; if (link.createGxsMessageLink(getLinkType(), groupId(), mMessageId, messageName())) { QList<RetroShareLink> urls; urls.push_back(link); RSLinkClipboard::copyLinks(urls); } }
void InjectedBundle::setMockGeolocationPosition(double latitude, double longitude, double accuracy) { WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetMockGeolocationPosition")); WKRetainPtr<WKMutableDictionaryRef> messageBody(AdoptWK, WKMutableDictionaryCreate()); WKRetainPtr<WKStringRef> latitudeKeyWK(AdoptWK, WKStringCreateWithUTF8CString("latitude")); WKRetainPtr<WKDoubleRef> latitudeWK(AdoptWK, WKDoubleCreate(latitude)); WKDictionaryAddItem(messageBody.get(), latitudeKeyWK.get(), latitudeWK.get()); WKRetainPtr<WKStringRef> longitudeKeyWK(AdoptWK, WKStringCreateWithUTF8CString("longitude")); WKRetainPtr<WKDoubleRef> longitudeWK(AdoptWK, WKDoubleCreate(longitude)); WKDictionaryAddItem(messageBody.get(), longitudeKeyWK.get(), longitudeWK.get()); WKRetainPtr<WKStringRef> accuracyKeyWK(AdoptWK, WKStringCreateWithUTF8CString("accuracy")); WKRetainPtr<WKDoubleRef> accuracyWK(AdoptWK, WKDoubleCreate(accuracy)); WKDictionaryAddItem(messageBody.get(), accuracyKeyWK.get(), accuracyWK.get()); WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get()); }
void TTObjectBase::getMessageNames(TTValue& messageNameList) { TTValue unfilteredNameList; TTUInt32 messageCount; messages->getKeys(unfilteredNameList); messageCount = unfilteredNameList.size(); messageNameList.clear(); for (TTUInt32 i=0; i<messageCount; i++) { TTMessagePtr message = NULL; TTSymbol messageName(kTTSymEmpty); messageName = unfilteredNameList[i]; getMessage(messageName, &message); if (message->hidden == NO) messageNameList.append(messageName); } }
void InjectedBundle::queueLoadHTMLString(WKStringRef content, WKStringRef baseURL, WKStringRef unreachableURL) { m_useWorkQueue = true; WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("QueueLoadHTMLString")); WKRetainPtr<WKMutableDictionaryRef> loadData(AdoptWK, WKMutableDictionaryCreate()); WKRetainPtr<WKStringRef> contentKey(AdoptWK, WKStringCreateWithUTF8CString("content")); WKDictionarySetItem(loadData.get(), contentKey.get(), content); if (baseURL) { WKRetainPtr<WKStringRef> baseURLKey(AdoptWK, WKStringCreateWithUTF8CString("baseURL")); WKDictionarySetItem(loadData.get(), baseURLKey.get(), baseURL); } if (unreachableURL) { WKRetainPtr<WKStringRef> unreachableURLKey(AdoptWK, WKStringCreateWithUTF8CString("unreachableURL")); WKDictionarySetItem(loadData.get(), unreachableURLKey.get(), unreachableURL); } WKBundlePostMessage(m_bundle, messageName.get(), loadData.get()); }
void InjectedBundle::postSetWindowIsKey(bool isKey) { WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetWindowIsKey")); WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(isKey)); WKBundlePostSynchronousMessage(m_bundle, messageName.get(), messageBody.get(), 0); }
void InjectedBundle::postSetBackingScaleFactor(double backingScaleFactor) { WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetBackingScaleFactor")); WKRetainPtr<WKDoubleRef> messageBody(AdoptWK, WKDoubleCreate(backingScaleFactor)); WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get()); }
void InjectedBundle::postFocusWebView() { WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("FocusWebView")); WKBundlePostMessage(m_bundle, messageName.get(), 0); }
void InjectedBundle::postRemoveChromeInputField() { WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("RemoveChromeInputField")); WKBundlePostMessage(m_bundle, messageName.get(), 0); }
void InjectedBundle::postNewBeforeUnloadReturnValue(bool value) { WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("BeforeUnloadReturnValue")); WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(value)); WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get()); }
void TestRunner::setHandlesAuthenticationChallenges(bool handlesAuthenticationChallenges) { WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetHandlesAuthenticationChallenge")); WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(handlesAuthenticationChallenges)); WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get()); }
void TestRunner::setAuthenticationPassword(JSStringRef password) { WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetAuthenticationPassword")); WKRetainPtr<WKStringRef> messageBody(AdoptWK, WKStringCreateWithJSString(password)); WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get()); }
void InjectedBundle::processWorkQueue() { WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("ProcessWorkQueue")); WKBundlePostMessage(m_bundle, messageName.get(), 0); }
void TestRunner::setAuthenticationUsername(JSStringRef username) { WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetAuthenticationUsername")); WKRetainPtr<WKStringRef> messageBody(AdoptWK, WKStringCreateWithJSString(username)); WKBundlePostMessage(InjectedBundle::shared().bundle(), messageName.get(), messageBody.get()); }
void TestRunner::setBlockAllPlugins(bool shouldBlock) { WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetBlockAllPlugins")); WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(shouldBlock)); WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get()); }
void GxsChannelPostItem::fill() { /* fill in */ if (isLoading()) { /* Wait for all requests */ return; } #ifdef DEBUG_ITEM std::cerr << "GxsChannelPostItem::fill()"; std::cerr << std::endl; #endif mInFill = true; QString title; if (!mIsHome) { if (mCloseOnRead && !IS_MSG_NEW(mPost.mMeta.mMsgStatus)) { removeItem(); } title = tr("Channel Feed") + ": "; RetroShareLink link; link.createGxsGroupLink(RetroShareLink::TYPE_CHANNEL, mPost.mMeta.mGroupId, groupName()); title += link.toHtml(); ui->titleLabel->setText(title); RetroShareLink msgLink; msgLink.createGxsMessageLink(RetroShareLink::TYPE_CHANNEL, mPost.mMeta.mGroupId, mPost.mMeta.mMsgId, messageName()); ui->subjectLabel->setText(msgLink.toHtml()); if (IS_GROUP_SUBSCRIBED(mGroup.mMeta.mSubscribeFlags) || IS_GROUP_ADMIN(mGroup.mMeta.mSubscribeFlags)) { ui->unsubscribeButton->setEnabled(true); } else { ui->unsubscribeButton->setEnabled(false); } ui->readButton->hide(); ui->newLabel->hide(); ui->copyLinkButton->hide(); if (IS_MSG_NEW(mPost.mMeta.mMsgStatus)) { mCloseOnRead = true; } } else { /* subject */ ui->titleLabel->setText(QString::fromUtf8(mPost.mMeta.mMsgName.c_str())); ui->subjectLabel->setText(RsHtml().formatText(NULL, QString::fromUtf8(mPost.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS)); //QString score = QString::number(post.mTopScore); // scoreLabel->setText(score); /* disable buttons: deletion facility not enabled with cache services yet */ ui->clearButton->setEnabled(false); ui->unsubscribeButton->setEnabled(false); ui->clearButton->hide(); ui->readAndClearButton->hide(); ui->unsubscribeButton->hide(); ui->copyLinkButton->show(); if (IS_GROUP_SUBSCRIBED(mGroup.mMeta.mSubscribeFlags) || IS_GROUP_ADMIN(mGroup.mMeta.mSubscribeFlags)) { ui->readButton->setVisible(true); setReadStatus(IS_MSG_NEW(mPost.mMeta.mMsgStatus), IS_MSG_UNREAD(mPost.mMeta.mMsgStatus) || IS_MSG_NEW(mPost.mMeta.mMsgStatus)); } else { ui->readButton->setVisible(false); ui->newLabel->setVisible(false); } mCloseOnRead = false; } // differences between Feed or Top of Comment. if (mFeedHolder) { if (mIsHome) { ui->commentButton->show(); } else { ui->commentButton->hide(); } // THIS CODE IS doesn't compile - disabling until fixed. #if 0 if (post.mComments) { QString commentText = QString::number(post.mComments); commentText += " "; commentText += tr("Comments"); ui->commentButton->setText(commentText); } else { ui->commentButton->setText(tr("Comment")); } #endif } else { ui->commentButton->hide(); } // disable voting buttons - if they have already voted. /*if (post.mMeta.mMsgStatus & GXS_SERV::GXS_MSG_STATUS_VOTE_MASK) { voteUpButton->setEnabled(false); voteDownButton->setEnabled(false); }*/ ui->msgLabel->setText(RsHtml().formatText(NULL, QString::fromUtf8(mPost.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS)); ui->msgFrame->setVisible(!mPost.mMsg.empty()); ui->datetimelabel->setText(DateTime::formatLongDateTime(mPost.mMeta.mPublishTs)); ui->filelabel->setText(QString("(%1 %2) %3").arg(mPost.mCount).arg(tr("Files")).arg(misc::friendlyUnit(mPost.mSize))); if (mFileItems.empty() == false) { std::list<SubFileItem *>::iterator it; for(it = mFileItems.begin(); it != mFileItems.end(); ++it) { delete(*it); } mFileItems.clear(); } std::list<RsGxsFile>::const_iterator it; for(it = mPost.mFiles.begin(); it != mPost.mFiles.end(); ++it) { /* add file */ std::string path; SubFileItem *fi = new SubFileItem(it->mHash, it->mName, path, it->mSize, SFI_STATE_REMOTE | SFI_TYPE_CHANNEL, RsPeerId()); mFileItems.push_back(fi); /* check if the file is a media file */ if (!misc::isPreviewable(QFileInfo(QString::fromUtf8(it->mName.c_str())).suffix())) { fi->mediatype(); /* check if the file is not a media file and change text */ ui->playButton->setText(tr("Open")); ui->playButton->setToolTip(tr("Open File")); } else { ui->playButton->setText(tr("Play")); ui->playButton->setToolTip(tr("Play Media")); } QLayout *layout = ui->expandFrame->layout(); layout->addWidget(fi); } if(mPost.mThumbnail.mData != NULL) { QPixmap thumbnail; thumbnail.loadFromData(mPost.mThumbnail.mData, mPost.mThumbnail.mSize, "PNG"); // Wiping data - as its been passed to thumbnail. ui->logoLabel->setPixmap(thumbnail); } mInFill = false; }
void InjectedBundle::postSimulateWebNotificationClick(uint64_t notificationID) { WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SimulateWebNotificationClick")); WKRetainPtr<WKUInt64Ref> messageBody(AdoptWK, WKUInt64Create(notificationID)); WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get()); }
void InjectedBundle::setGeolocationPermission(bool enabled) { WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetGeolocationPermission")); WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(enabled)); WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get()); }
void PostedItem::fill() { if (isLoading()) { /* Wait for all requests */ return; } mInFill = true; QDateTime qtime; qtime.setTime_t(mPost.mMeta.mPublishTs); QString timestamp = qtime.toString("hh:mm dd-MMM-yyyy"); ui->dateLabel->setText(timestamp); ui->fromLabel->setId(mPost.mMeta.mAuthorId); // Use QUrl to check/parse our URL // The only combination that seems to work: load as EncodedUrl, extract toEncoded(). QByteArray urlarray(mPost.mLink.c_str()); QUrl url = QUrl::fromEncoded(urlarray.trimmed()); QString urlstr = "Invalid Link"; QString sitestr = "Invalid Link"; bool urlOkay = url.isValid(); if (urlOkay) { QString scheme = url.scheme(); if ((scheme != "https") && (scheme != "http") && (scheme != "ftp") && (scheme != "retroshare")) { urlOkay = false; sitestr = "Invalid Link Scheme"; } } if (urlOkay) { urlstr = QString("<a href=\""); urlstr += QString(url.toEncoded()); urlstr += QString("\" ><span style=\" text-decoration: underline; color:#2255AA;\"> "); urlstr += messageName(); urlstr += QString(" </span></a>"); QString siteurl = url.scheme() + "://" + url.host(); sitestr = QString("<a href=\"%1\" ><span style=\" text-decoration: underline; color:#2255AA;\"> %2 </span></a>").arg(siteurl).arg(siteurl); } ui->titleLabel->setText(urlstr); ui->siteLabel->setText(sitestr); //QString score = "Hot" + QString::number(post.mHotScore); //score += " Top" + QString::number(post.mTopScore); //score += " New" + QString::number(post.mNewScore); QString score = QString::number(mPost.mTopScore); ui->scoreLabel->setText(score); // FIX THIS UP LATER. ui->notes->setText(QString::fromUtf8(mPost.mNotes.c_str())); // differences between Feed or Top of Comment. if (mFeedHolder) { // feed. ui->frame_notes->hide(); //frame_comment->show(); ui->commentButton->show(); if (mPost.mComments) { QString commentText = QString::number(mPost.mComments); commentText += " "; commentText += tr("Comments"); ui->commentButton->setText(commentText); } else { ui->commentButton->setText(tr("Comment")); } setReadStatus(IS_MSG_NEW(mPost.mMeta.mMsgStatus), IS_MSG_UNREAD(mPost.mMeta.mMsgStatus) || IS_MSG_NEW(mPost.mMeta.mMsgStatus)); } else { // no feed. if(ui->notes->text().isEmpty()) { ui->frame_notes->hide(); } else { ui->frame_notes->show(); } //frame_comment->hide(); ui->commentButton->hide(); ui->readButton->hide(); ui->newLabel->hide(); } if (mIsHome) { ui->clearButton->hide(); ui->readAndClearButton->hide(); } else { ui->clearButton->show(); ui->readAndClearButton->show(); } // disable voting buttons - if they have already voted. if (mPost.mMeta.mMsgStatus & GXS_SERV::GXS_MSG_STATUS_VOTE_MASK) { ui->voteUpButton->setEnabled(false); ui->voteDownButton->setEnabled(false); } #if 0 uint32_t up, down, nComments; bool ok = rsPosted->retrieveScores(mPost.mMeta.mServiceString, up, down, nComments); if(ok) { int32_t vote = up - down; scoreLabel->setText(QString::number(vote)); numCommentsLabel->setText("<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px;" "margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span" "style=\" font-size:10pt; font-weight:600;\">#</span><span " "style=\" font-size:8pt; font-weight:600;\"> Comments: " + QString::number(nComments) + "</span></p>"); } #endif mInFill = false; emit sizeChanged(this); }
void InjectedBundle::setMockGeolocationPositionUnavailableError(WKStringRef errorMessage) { WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetMockGeolocationPositionUnavailableError")); WKBundlePostMessage(m_bundle, messageName.get(), errorMessage); }
void InjectedBundle::postSetAddsVisitedLinks(bool addsVisitedLinks) { WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetAddsVisitedLinks")); WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(addsVisitedLinks)); WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get()); }