Пример #1
0
void CandidateWindowProxy::candidateActivate(int nr, int displayLimit)
{
#ifdef UIM_QT_USE_DELAY
    m_delayTimer->stop();
#endif /* !UIM_QT_USE_DELAY */

   QList<uim_candidate> list;

#if !UIM_QT_USE_NEW_PAGE_HANDLING
    activateCandwin(displayLimit);

    // set candidates
    for (int i = 0; i < nr; i++) {
        cand = uim_get_candidate(ic->uimContext(), i,
                displayLimit ? i % displayLimit : i);
        list.append(cand);
    }
    setCandidates(displayLimit, list);

#else /* !UIM_QT_USE_NEW_PAGE_HANDLING */
    nrPages = displayLimit ? (nr - 1) / displayLimit + 1 : 1;
    pageFilled.clear();
    for (int i = 0; i < nrPages; i++)
        pageFilled.append(false);
    
    setNrCandidates(nr, displayLimit);

    // set page candidates
    preparePageCandidates(0);
    setPage(0);
#endif /* !UIM_QT_USE_NEW_PAGE_HANDLING */

    execute("candidate_activate");
}
Пример #2
0
void CandidateWindow::strParse( const QString& str )
{
#if defined(ENABLE_DEBUG)
    qDebug( "str = %s", ( const char* ) str.local8Bit() );
#endif
    QStringList list = QStringList::split( "\f", str );

    QStringList::Iterator it = list.begin();
    const QStringList::Iterator end = list.end();
    for ( ; it != end; ++it )
    {
        if ( QString::compare( "activate", ( *it ) ) == 0 )
            activateCand( list );
        else if ( QString::compare( "select", ( *it ) ) == 0 )
            selectCand( list );
        else if ( QString::compare( "show", ( *it ) ) == 0 )
            showCand();
        else if ( QString::compare( "hide", ( *it ) ) == 0 )
            hide();
        else if ( QString::compare( "move", ( *it ) ) == 0 )
            moveCand( list );
        else if ( QString::compare( "deactivate", ( *it ) ) == 0 )
            deactivateCand();
        else if ( QString::compare( "set_nr_candidates", ( *it ) ) == 0 )
            setNrCandidates( list );
        else if ( QString::compare( "set_page_candidates", ( *it ) ) == 0 )
            setPageCandidates( list );
        else if ( QString::compare( "show_page", ( *it ) ) == 0 )
            showPage( list );
    }
}
Пример #3
0
void XimCandidateWindow::slotStdinActivated(int fd)
{
    QList<QStringList> messageList = parse_messages(get_messages(fd));
    for (int i = 0, j = messageList.count(); i < j; i++) {
        QStringList message = messageList[i];
        QString command = message[0];
        if (command == "activate")
            activateCand(message);
        else if (command == "select")
            selectCand(message);
        else if (command == "show")
            showCand();
        else if (command == "hide")
            hide();
        else if (command == "move")
            moveCand(message);
        else if (command == "deactivate")
            deactivateCand();
        else if (command == "set_nr_candidates")
            setNrCandidates(message);
        else if (command == "set_page_candidates")
            setPageCandidates(message);
        else if (command == "show_page")
            showPage(message);
    }
}