Beispiel #1
0
QString HistoryItem::inDialogsText(DrawInDialog way) const {
	auto getText = [this]() {
		if (_media) {
			return _media->chatListText();
		} else if (!emptyText()) {
			return TextUtilities::Clean(_text.originalText());
		}
		return QString();
	};
	const auto plainText = getText();
	const auto sender = [&]() -> PeerData* {
		if (isPost() || isEmpty() || (way == DrawInDialog::WithoutSender)) {
			return nullptr;
		} else if (!_history->peer->isUser() || out()) {
			return author();
		} else if (_history->peer->isSelf() && !Has<HistoryMessageForwarded>()) {
			return senderOriginal();
		}
		return nullptr;
	}();
	if (sender) {
		auto fromText = sender->isSelf() ? lang(lng_from_you) : sender->shortName();
		auto fromWrapped = textcmdLink(1, lng_dialogs_text_from_wrapped(lt_from, TextUtilities::Clean(fromText)));
		return lng_dialogs_text_with_from(lt_from_part, fromWrapped, lt_message, plainText);
	}
	return plainText;
}
Beispiel #2
0
bool Outline::paint()
//-------------------
{
    OutlineElement * elm;
    int              maxRows = getRows();
    int              index = -1 * _topIndex;
    WPoint           hotSize;
    WPoint           avg;
    WPoint           max;

    textMetrics( avg, max );

    if( count() ) {
        GlobalHotSpots->hotSpotSize( OutlineLeafUp, hotSize );  // rely on all being same size

        for( elm = element( 0 ); elm != NULL; elm = elm->visibleSib() ) {
            elm->drawLine( this, index, hotSize.x(), max.y() );

            if( index >= maxRows ) {
                break;
            }
        }

        return HotWindowList::paint();
    } else {
        ScreenDev dev;

        dev.open( this );
        dev.drawText( WPoint( 0, 0 ), emptyText() );
        dev.close();

        return true;
    }
}
Beispiel #3
0
QString HistoryItem::notificationText() const {
	auto getText = [this]() {
		if (_media) {
			return _media->notificationText();
		} else if (!emptyText()) {
			return _text.originalText();
		}
		return QString();
	};

	auto result = getText();
	if (result.size() > 0xFF) {
		result = result.mid(0, 0xFF) + qsl("...");
	}
	return result;
}
Beispiel #4
0
void TagRenamerOptions::saveConfig(unsigned categoryNum) const
{
    // Make sure we don't use translated strings for the config file keys.

    QString typeKey = tagTypeText(false);
    if(categoryNum > 0)
        typeKey.append(QString::number(categoryNum));

    KConfigGroup config(KGlobal::config(), "FileRenamer");

    config.writeEntry(QString("%1Suffix").arg(typeKey), suffix());
    config.writeEntry(QString("%1Prefix").arg(typeKey), prefix());

    QString emptyStr;

    switch(emptyAction()) {
    case ForceEmptyInclude:
        emptyStr = "ForceEmptyInclude";
    break;

    case IgnoreEmptyTag:
        emptyStr = "IgnoreEmptyTag";
    break;

    case UseReplacementValue:
        emptyStr = "UseReplacementValue";
    break;
    }

    config.writeEntry(QString("%1EmptyAction").arg(typeKey), emptyStr);
    config.writeEntry(QString("%1EmptyText").arg(typeKey), emptyText());
    config.writeEntry(QString("%1Disabled").arg(typeKey), disabled());

    if(category() == Track)
        config.writeEntry(QString("%1TrackWidth").arg(typeKey), trackWidth());

    config.sync();
}
Beispiel #5
0
bool HistoryMessage::textHasLinks() const {
	return emptyText() ? false : _text.hasLinks();
}
Beispiel #6
0
TextWithEntities HistoryMessage::clipboardText() const {
	if (emptyText()) {
		return { QString(), EntitiesInText() };
	}
	return _text.originalTextWithEntities(AllTextSelection, ExpandLinksAll);
}
Beispiel #7
0
TextWithEntities HistoryMessage::originalText() const {
	if (emptyText()) {
		return { QString(), EntitiesInText() };
	}
	return _text.originalTextWithEntities();
}