Ejemplo n.º 1
0
void IconController::startLoader()
{
    // FIXME: We kick off the icon loader when the frame is done receiving its main resource.
    // But we should instead do it when we're done parsing the head element.
    if (!m_frame->loader()->isLoadingMainFrame())
        return;

    if (!iconDatabase().isEnabled())
        return;

    ASSERT(!m_frame->tree()->parent());
    if (!documentCanHaveIcon(m_frame->document()->url()))
        return;

    KURL iconURL(url());
    String urlString(iconURL.string());
    if (urlString.isEmpty())
        return;

    // People who want to avoid loading images generally want to avoid loading all images, unless an exception has been made for site icons.
    // Now that we've accounted for URL mapping, avoid starting the network load if images aren't set to display automatically.
    Settings* settings = m_frame->settings();
    if (settings && !settings->loadsImagesAutomatically() && !settings->loadsSiteIconsIgnoringImageLoadingSetting())
        return;

    // If we're reloading the page, always start the icon load now.
    // FIXME: How can this condition ever be true?
    if (m_frame->loader()->loadType() == FrameLoadTypeReload && m_frame->loader()->loadType() == FrameLoadTypeReloadFromOrigin) {
        continueLoadWithDecision(IconLoadYes);
        return;
    }

    if (iconDatabase().supportsAsynchronousMode()) {
        //  FIXME (<rdar://problem/9168605>) - We should support in-memory-only private browsing icons in asynchronous icon database mode.
        if (iconDatabase().supportsAsynchronousMode() && m_frame->page()->settings()->privateBrowsingEnabled())
            return;

        m_frame->loader()->documentLoader()->getIconLoadDecisionForIconURL(urlString);
        // Commit the icon url mapping to the database just in case we don't end up loading later.
        commitToDatabase(iconURL);
        return;
    }

    IconLoadDecision decision = iconDatabase().synchronousLoadDecisionForIconURL(urlString, m_frame->loader()->documentLoader());

    if (decision == IconLoadUnknown) {
        // In this case, we may end up loading the icon later, but we still want to commit the icon url mapping to the database
        // just in case we don't end up loading later - if we commit the mapping a second time after the load, that's no big deal
        // We also tell the client to register for the notification that the icon is received now so it isn't missed in case the 
        // icon is later read in from disk
        LOG(IconDatabase, "IconController %p might load icon %s later", this, urlString.ascii().data());
        m_waitingForLoadDecision = true;    
        m_frame->loader()->client()->registerForIconNotification();
        commitToDatabase(iconURL);
        return;
    }

    continueLoadWithDecision(decision);
}
Ejemplo n.º 2
0
void NewJoinWidget::changeInfo()
{
	refresh();
	
	int flag = view->currentIndex().column();
	
	if (flag == 0) {
		QMessageBox::information(this, tr("修改操作失败"),
                              tr("没找到您选择了哪一行哎~~<p>请您先选择待修改的行好吗?"));
		return;
	}	
	
	int rowNum = view->currentIndex().row();

	ChangeInfoDialog changeInfoDialog(sqlModel, rowNum);
	
	if (changeInfoDialog.exec() == QDialog::QDialog::Rejected) {
		return;
	}
	
	changeRowInfo(changeInfoDialog, rowNum);
	commitToDatabase();

	// 按照显示内容重新调整列宽度
	view->resizeColumnsToContents();
}
Ejemplo n.º 3
0
void NewJoinWidget::submitDataChange()
{
	int choose = QMessageBox::question(this, tr("数据提交确认"),
                      	      tr("<H3>您确认要把当前数据表显示的数据提交到数据库吗?</H3>"
					"<p><font color=red>* 注意此操作不可逆!</font>"),
				QMessageBox::Yes | QMessageBox::No);

	if (choose == QMessageBox::Yes) {
		commitToDatabase();
	}

	// 按照显示内容重新调整列宽度
	view->resizeColumnsToContents();
}
void IconController::continueLoadWithDecision(IconLoadDecision iconLoadDecision)
{
    ASSERT(iconLoadDecision != IconLoadUnknown);

    //  FIXME (<rdar://problem/9168605>) - We should support in-memory-only private browsing icons in asynchronous icon database mode.
    if (iconDatabase().supportsAsynchronousMode() && m_frame->page()->settings()->privateBrowsingEnabled())
        return;

    if (iconLoadDecision == IconLoadNo) {
        KURL iconURL(url());
        String urlString(iconURL.string());
        if (urlString.isEmpty())
            return;

        LOG(IconDatabase, "IconController::startLoader() - Told not to load this icon, committing iconURL %s to database for pageURL mapping", urlString.ascii().data());
        commitToDatabase(iconURL);

        if (iconDatabase().supportsAsynchronousMode()) {
            m_frame->loader()->documentLoader()->getIconDataForIconURL(urlString);
            return;
        }

        // We were told not to load this icon - that means this icon is already known by the database
        // If the icon data hasn't been read in from disk yet, kick off the read of the icon from the database to make sure someone
        // has done it. This is after registering for the notification so the WebView can call the appropriate delegate method.
        // Otherwise if the icon data *is* available, notify the delegate
        if (!iconDatabase().synchronousIconDataKnownForIconURL(urlString)) {
            LOG(IconDatabase, "Told not to load icon %s but icon data is not yet available - registering for notification and requesting load from disk", urlString.ascii().data());
            m_frame->loader()->client()->registerForIconNotification();
            iconDatabase().synchronousIconForPageURL(m_frame->document()->url().string(), IntSize(0, 0));
            iconDatabase().synchronousIconForPageURL(m_frame->loader()->initialRequest().url().string(), IntSize(0, 0));
        } else
            m_frame->loader()->client()->dispatchDidReceiveIcon();

        return;
    } 

    if (!m_iconLoader)
        m_iconLoader = IconLoader::create(m_frame);

    m_iconLoader->startLoading();
}
Ejemplo n.º 5
0
void NewJoinWidget::addInfo()
{
	refresh();
	
	int rowNum = sqlModel->rowCount();	// 获得表的行数
	sqlModel->insertRow(rowNum);		// 新插入行的位置就是表的行数,因为插入位置从 0 开始计算

	ChangeInfoDialog changeInfoDialog(sqlModel, rowNum);
	
	if (changeInfoDialog.exec() == QDialog::QDialog::Rejected) {
		refresh();
		return;
	}
	
	changeRowInfo(changeInfoDialog, rowNum);
	commitToDatabase();

	// 按照显示内容重新调整列宽度
	view->resizeColumnsToContents();
}
Ejemplo n.º 6
0
void NewJoinWidget::delInfo()
{
	refresh();	
	
	int flag = view->currentIndex().column();
	
	if (flag == 0) {
		QMessageBox::information(this, tr("删除操作失败"),
                              tr("没找到您选择了哪一行哎~~<p>请您前先选择带删除的行好吗?"));
		return;
	}

	int choose = QMessageBox::question(this, tr("数据删除确认"),
                      	      tr("<H3>您确认要把当前选中行删除并提交到数据库吗?</H3>"
					"<p><font color=red>* 注意此操作不可逆!</font>"),
				QMessageBox::Yes | QMessageBox::No);

	if (choose == QMessageBox::Yes) {
		sqlModel->removeRow(view->currentIndex().row());
		commitToDatabase();
	}
}