void EditNoteForm::loadAll()
{
	_tagHandler.reload();
	adjustTags(_selectedTags, _deselectedTags);

	if (ui->le_Title->isVisible())
		ui->le_Title->setFocus();
	else
		ui->te_NoteHtmlText->setFocus();

	QObject::connect(ui->tv_Tags->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
					 this, SLOT(adjustTags(QItemSelection,QItemSelection)));
}
void EditNoteForm::adjustTags()
{
	_note.clearTags();
	QStringList tags = ui->le_Tags->text().split(",", QString::SkipEmptyParts);
	foreach (QString tag, tags)
		if (!tag.simplified().isEmpty())
			_note.appendTag(tag.simplified());

	adjustTags(_selectedTags, _deselectedTags);
}
void EditNoteForm::finish()
{
	adjustTags();
	if (_note.noteID().isNull())
		_note.create(ui->le_Title->text(),
					 ui->te_NoteHtmlText->toPlainText(),
					 ui->te_NoteHtmlText->toHtml(),
					 ui->dte_Date->dateTime(),
					 _noteShowingTemplate);
	else
		_note.update(ui->le_Title->text(),
					 ui->te_NoteHtmlText->toPlainText(),
					 ui->te_NoteHtmlText->toHtml(),
					 ui->dte_Date->dateTime(),
					 _noteShowingTemplate);
	emit finishNote(_note);
}
Beispiel #4
0
void ArabicShaping::shape(const LEUnicode *chars, le_int32 offset, le_int32 charCount, le_int32 charMax,
                          le_bool rightToLeft, LEGlyphStorage &glyphStorage)
{
    // iterate in logical order, store tags in visible order
    // 
    // the effective right char is the most recently encountered 
    // non-transparent char
    //
    // four boolean states:
    //   the effective right char shapes
    //   the effective right char causes left shaping
    //   the current char shapes
    //   the current char causes right shaping
    // 
    // if both cause shaping, then
    //   shaper.shape(errout, 2) (isolate to initial, or final to medial)
    //   shaper.shape(out, 1) (isolate to final)

    ShapeType rightType = ST_NOSHAPE_NONE, leftType = ST_NOSHAPE_NONE;
    LEErrorCode success = LE_NO_ERROR;
    le_int32 i;

    for (i = offset - 1; i >= 0; i -= 1) {
        rightType = getShapeType(chars[i]);
        
        if (rightType != ST_TRANSPARENT) {
            break;
        }
    }

    for (i = offset + charCount; i < charMax; i += 1) {
        leftType = getShapeType(chars[i]);

        if (leftType != ST_TRANSPARENT) {
            break;
        }
    }

    // erout is effective right logical index
    le_int32 erout = -1;
    le_bool rightShapes = FALSE;
    le_bool rightCauses = (rightType & MASK_SHAPE_LEFT) != 0;
    le_int32 in, e, out = 0, dir = 1;

    if (rightToLeft) {
        out = charCount - 1;
        erout = charCount;
        dir = -1;
    }

    for (in = offset, e = offset + charCount; in < e; in += 1, out += dir) {
        LEUnicode c = chars[in];
        ShapeType t = getShapeType(c);

        if (t == ST_NOSHAPE_NONE) {
            glyphStorage.setAuxData(out, NO_FEATURES, success);
        } else {
            glyphStorage.setAuxData(out, ISOL_FEATURES, success);
        }


        if ((t & MASK_TRANSPARENT) != 0) {
            continue;
        }

        le_bool curShapes = (t & MASK_NOSHAPE) == 0;
        le_bool curCauses = (t & MASK_SHAPE_RIGHT) != 0;

        if (rightCauses && curCauses) {
            if (rightShapes) {
                adjustTags(erout, 2, glyphStorage);
            }

            if (curShapes) {
                adjustTags(out, 1, glyphStorage);
            }
        }

        rightShapes = curShapes;
        rightCauses = (t & MASK_SHAPE_LEFT) != 0;
        erout = out;
    }

    if (rightShapes && rightCauses && (leftType & MASK_SHAPE_RIGHT) != 0) {
        adjustTags(erout, 2, glyphStorage);
    }
}