示例#1
0
/**
 * Runs a query in a query page.
 * A query page is first selected, with a new one created if required. The
 * method then creates a Cscope process and runs the query.
 * @param	nType	The query's numeric type code
 * @param	sText	The query's text, as entered by the user
 */
void QueryWidget::initQuery(uint nType, const QString& sText)
{
    QueryPage* pPage;

    // Make sure we have a query page
    findQueryPage();
    pPage = (QueryPage*)currentPage();

    // Use the current page, or a new page if the current one is locked
    if (pPage->isLocked()) {
        addQueryPage();
        pPage = (QueryPage*)currentPage();
    }

    // Reset the page's results list
    pPage->clear();
    pPage->query(nType, sText);

    // Set the page's tab text according to the new query
    setPageCaption(pPage);
}
示例#2
0
/**
 * Reruns the query whose results are displayed in the current page.
 */
void QueryWidget::slotRefreshCurrent()
{
    QueryPage* pPage;
    uint nType;
    QString sText;

    // Make sure the current page is a valid, non-empty one
    pPage = dynamic_cast<QueryPage*>(currentPage());
    if ((pPage == NULL) ||
            (pPage->getQueryType() == CscopeFrontend::None)) {
        return;
    }

    // Get the current page parameters (before they are deleted by clear())
    nType = pPage->getQueryType();
    sText = pPage->getQueryText();

    // Clear the current page contents
    pPage->clear();
    pPage->query(nType, sText);
}