7#include "searchlinecommandbuttonswidget.h"
8#include "searchlinecommandflowlayout.h"
9#include <KLocalizedString>
14SearchLineCommandButtonsWidget::SearchLineCommandButtonsWidget(
QWidget *parent)
17 auto flowLayout =
new SearchLineCommandFlowLayout(
this);
18 flowLayout->setObjectName(QStringLiteral(
"flowLayout"));
19 flowLayout->setContentsMargins({});
20 flowLayout->setSpacing(0);
21 flowLayout->setHorizontalSpacing(0);
22 flowLayout->setVerticalSpacing(0);
24 Q_ASSERT(!mButtonsList.isEmpty());
25 for (
const auto &info : std::as_const(mButtonsList)) {
26 flowLayout->addWidget(createPushButton(info.needSpace, info.i18n, info.identifier));
30SearchLineCommandButtonsWidget::~SearchLineCommandButtonsWidget() =
default;
32QPushButton *SearchLineCommandButtonsWidget::createPushButton(
bool needSpace,
const QString &i18nStr,
const QString &commandStr)
35 pushButton->setObjectName(commandStr);
36 pushButton->setToolTip(commandStr);
38 const QString str = commandStr + (needSpace ? QStringLiteral(
" ") :
QString());
44void SearchLineCommandButtonsWidget::fillWidgets()
47 {
false, QStringLiteral(
"subject:"),
i18nc(
"@action:button",
"Subject")},
48 {
false, QStringLiteral(
"body:"),
i18nc(
"@action:button",
"Body")},
49 {
false, QStringLiteral(
"from:"),
i18nc(
"@action:button",
"From")},
50 {
false, QStringLiteral(
"to:"),
i18nc(
"@action:button",
"To")},
51 {
false, QStringLiteral(
"cc:"),
i18nc(
"@action:button",
"Cc")},
52 {
false, QStringLiteral(
"bcc:"),
i18nc(
"@action:button",
"Bcc")},
53 {
true, QStringLiteral(
"has:attachment"),
i18nc(
"@action:button",
"Has Attachment")},
54 {
true, QStringLiteral(
"has:invitation"),
i18nc(
"@action:button",
"Has Invitation")},
55 {
true, QStringLiteral(
"is:read"),
i18nc(
"@action:button",
"Read")},
56 {
true, QStringLiteral(
"is:unread"),
i18nc(
"@action:button",
"Unread")},
57 {
true, QStringLiteral(
"is:important"),
i18nc(
"@action:button",
"Important")},
58 {
true, QStringLiteral(
"is:ignored"),
i18nc(
"@action:button",
"Ignored")},
59 {
true, QStringLiteral(
"is:ham"),
i18nc(
"@action:button",
"Ham")},
60 {
true, QStringLiteral(
"is:spam"),
i18nc(
"@action:button",
"Spam")},
61 {
true, QStringLiteral(
"is:watched"),
i18nc(
"@action:button",
"Watched")},
62 {
true, QStringLiteral(
"is:replied"),
i18nc(
"@action:button",
"Replied")},
63 {
true, QStringLiteral(
"is:forwarded"),
i18nc(
"@action:button",
"Forwarded")},
65 {
false, QStringLiteral(
"smaller:"),
i18nc(
"@action:button",
"Smaller")},
66 {
false, QStringLiteral(
"larger:"),
i18nc(
"@action:button",
"Larger")},
67 {
false, QStringLiteral(
"size:"),
i18nc(
"@action:button",
"Size")},
68 {
false, QStringLiteral(
"older_than:"),
i18nc(
"@action:button",
"Older")},
69 {
false, QStringLiteral(
"newer_than:"),
i18nc(
"@action:button",
"Newer")},
70 {
false, QStringLiteral(
"category:"),
i18nc(
"@action:button",
"Category")},
75#include "moc_searchlinecommandbuttonswidget.cpp"
QString i18nc(const char *context, const char *text, const TYPE &arg...)
The implementation independent part of the MessageList library.
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)