Exemplo n.º 1
0
void TitleBar::onCommentPageLoaded(bool ok)
{
#ifdef USEWEBENGINE
    QWebEngineView* comments = noteView()->commentView();
#else
    CWizLocalProgressWebView* commentWidget = noteView()->commentWidget();
    commentWidget->web()->history()->clear();
#endif
    if (!ok)
    {
        qDebug() << "Wow, load comment page failed! " << commentWidget->web()->url();
        loadErrorPage();
        commentWidget->show();
    }
    else
    {
        commentWidget->hideLocalProgress();
    }
#ifdef USEWEBENGINE
    else
    {
Exemplo n.º 2
0
void TitleBar::onCommentsButtonClicked()
{
#ifdef USEWEBENGINE
    QWebEngineView* comments = noteView()->commentView();
#else
    CWizLocalProgressWebView* commentWidget = noteView()->commentWidget();
#endif
    if (commentWidget->isVisible()) {
        commentWidget->hide();

        WizGetAnalyzer().LogAction("hideComments");

        return;
    }

    WizGetAnalyzer().LogAction("showComments");

    if (isNetworkAccessible()) {
        if (!m_commentsUrl.isEmpty()) {
            commentWidget->showLocalProgress();
            commentWidget->web()->load(m_commentsUrl);
            QSplitter* splitter = qobject_cast<QSplitter*>(commentWidget->parentWidget());
            Q_ASSERT(splitter);
            QList<int> li = splitter->sizes();
            Q_ASSERT(li.size() == 2);
            QList<int> lin;
            lin.push_back(li.value(0) - COMMENT_FRAME_WIDTH);
            lin.push_back(li.value(1) + COMMENT_FRAME_WIDTH);
            splitter->setSizes(lin);
            commentWidget->show();
        } else {
            loadErrorPage();
            commentWidget->show();
        }

    } else {
        m_commentsBtn->setEnabled(false);
    }
}