/**
 * 2nd part of the object initialization that must be callable during the
 * object's lifetime (not only on construction).
 */
void CContactCache::initPhaseTwo()
{
	PROTOACCOUNT*	acc = 0;

	m_szAccount = 0;
	if(m_szProto) {
		acc = reinterpret_cast<PROTOACCOUNT *>(::CallService(MS_PROTO_GETACCOUNT, (WPARAM)0, (LPARAM)m_szProto));
		if(acc && acc->tszAccountName)
			m_szAccount = acc->tszAccountName;
	}

	m_Valid = (m_szProto != 0 && m_szAccount != 0) ? true : false;
	if(m_Valid) {
		m_isMeta = (PluginConfig.bMetaEnabled && !strcmp(m_szProto, PluginConfig.szMetaName)) ? true : false;
		m_isSubcontact = (M->GetByte(m_hContact, PluginConfig.szMetaName, "IsSubcontact", 0) ? true : false);
		if(m_isMeta)
			updateMeta(true);
		updateState();
		updateFavorite();
	}
	else {
		m_szProto = C_INVALID_PROTO;
		m_tszProto = C_INVALID_PROTO_T;
		m_szAccount = C_INVALID_ACCOUNT;
		m_isMeta = false;
	}
}
Esempio n. 2
0
/**
 * 2nd part of the object initialization that must be callable during the
 * object's lifetime (not only on construction).
 */
void CContactCache::initPhaseTwo()
{
	m_szAccount = 0;
	if (cc->szProto) {
		PROTOACCOUNT *acc = Proto_GetAccount(cc->szProto);
		if (acc && acc->tszAccountName)
			m_szAccount = acc->tszAccountName;
	}

	m_Valid = (cc->szProto != 0 && m_szAccount != 0) ? true : false;
	if (m_Valid) {
		m_isMeta = db_mc_isMeta(cc->contactID) != 0; // don't use cc->IsMeta() here
		if (m_isMeta)
			updateMeta();
		updateState();
		updateFavorite();
	}
	else {
		m_szAccount = C_INVALID_ACCOUNT;
		m_isMeta = false;
	}
}
Esempio n. 3
0
WebPageForm::Private::Private(WebPageForm *parent)
    : q(parent)
    , tab(NULL)
    , settings(QSettings::IniFormat, QSettings::UserScope, KANMEMO_PROJECT, KANMEMO_NAME_FAV)
{
    ui.setupUi(q);

    //検索を非表示
    setFindVisiblity(false);

    //WebViewの読込み開始
    connect(ui.webView, &QWebView::loadStarted, [this](){
        ui.progressBar->show();
    });
    //WebViewの読込み完了
    connect(ui.webView, &QWebView::loadFinished, [this](bool ok) {
        Q_UNUSED(ok);
        //        if (ok) {
        //            ui.statusBar->showMessage(MainWindow::tr("complete"), STATUS_BAR_MSG_TIME);
        //        } else {
        //            ui.statusBar->showMessage(MainWindow::tr("error"), STATUS_BAR_MSG_TIME);
        //        }
        ui.progressBar->hide();

        //タイトル更新
        setParentTitle(QString("%1...").arg(ui.webView->title().left(10)));
    });
    //WebViewの読込み状態
    connect(ui.webView, &QWebView::loadProgress, ui.progressBar, &QProgressBar::setValue);

    //URLが変更された
    connect(ui.webView, &QWebView::urlChanged, [this]() {
        ui.urlEdit->setText(ui.webView->url().toString());
        ui.favoriteButton->setChecked(isExistFavorite(ui.webView->url().toString()));
    });

    //URLの編集完了
    connect(ui.urlEdit, &QLineEdit::editingFinished, [this]() {
        if(ui.webView->url().toString() == ui.urlEdit->text())
            return;
        ui.webView->setUrl(ui.urlEdit->text());
    });
    //戻る
    connect(ui.goBackButton, &QPushButton::clicked, [this]() {
        ui.webView->back();
    });
    //進む
    connect(ui.goForwardButton, &QPushButton::clicked, [this]() {
        ui.webView->forward();
    });
    //リロード
    connect(ui.reloadButton, &QPushButton::clicked, [this]() {
        ui.webView->reload();
    });
    //お気に入り
    connect(ui.favoriteButton, &QPushButton::clicked, [this]() {
        updateFavorite(ui.webView->url().toString(), ui.webView->title(), ui.favoriteButton->isChecked());
    });

    //モバイルとPC版の切り換え
    connect(ui.changeMobileModeButton, &QPushButton::clicked, [this]() {
//        WebPage *page = reinterpret_cast<WebPage *>(ui.webView->page());
//        qDebug() << "USER_AGENT:" << page->userAgentForUrl(ui.webView->url());
        q->setMobileMode(ui.changeMobileModeButton->isChecked());
        ui.webView->reload();
    });

    //検索
    connect(ui.findEdit, &QLineEdit::textChanged, [this]() {
        ui.webView->findText(QString(), QWebPage::HighlightAllOccurrences);    //ハイライトを消す
        if(ui.webView->findText(ui.findEdit->text())){
            //検索できた
            ui.webView->findText(ui.findEdit->text(), QWebPage::HighlightAllOccurrences);//ハイライトする
        }
    });

}