Esempio n. 1
0
void Editor::uncommentSelection()
{
    int paragraphStart;
    int paragraphEnd;
    int indexStart;
    int indexEnd;
    getSelection(&paragraphStart, &indexStart, &paragraphEnd, &indexEnd);

    if (paragraphStart < 0) {
        getCursorPosition(&paragraphStart, &indexStart);
        paragraphEnd = paragraphStart;
    }

    if (paragraphStart >= 0 && paragraphEnd >= 0) {
        for (int i=paragraphStart; i<=paragraphEnd; ++i) {
            QString str = text(i);

            int whitespace = 0;
            while (str.startsWith("/") || (str.length() > 0 && str.at(0).isSpace())) {
                if (str.length() > 0 && str.at(0).isSpace()) ++whitespace;
                str.remove(0, 1);
            }

            if (whitespace > 0)
                str.prepend(QString().fill(QChar(' '), whitespace));

            insertParagraph(str, i);
            removeParagraph(i + 1);

        }

        repaintChanged();
        setModified(TRUE);       
    }
}
Esempio n. 2
0
void MsgView::deleteUser(unsigned long uin)
{
    QString pat;
    pat.sprintf("<a href=\"msg://%lu.", uin);
    for (int i = 0; i < paragraphs();){
        if (text(i).find(pat) < 0){
            for (i++; i < paragraphs(); i++)
                if (text(i).find("<a href=\"msg://") >= 0) break;
            continue;
        }
        removeParagraph(i);
        for (; i < paragraphs(); ){
            if (text(i).find("<a href=\"msg://") >= 0) break;
            unsigned n = paragraphs();
            removeParagraph(i);
            if (n == paragraphs()){
                i++;
                break;
            }
        }
    }
}
Esempio n. 3
0
void QMultiLineEdit::removeLine( int paragraph )
{
    removeParagraph( paragraph );
}