Akonadi Contacts

blogfeedwidget.cpp
1/*
2 This file is part of Contact Editor.
3
4 SPDX-FileCopyrightText: 2018-2020 Laurent Montel <montel.org>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8
9#include "blogfeedwidget.h"
10#include <KContacts/Addressee>
11#include <KLineEdit>
12#include <KLocalizedString>
13#include <QLabel>
14#include <QVBoxLayout>
15using namespace Akonadi;
16
17BlogfeedWidget::BlogfeedWidget(QWidget *parent)
18 : QWidget(parent)
19 , mBlogFeed(new KLineEdit(this))
20{
21 auto topLayout = new QVBoxLayout(this);
22 topLayout->setContentsMargins({});
23 topLayout->setObjectName(QLatin1StringView("mainlayout"));
24 auto blogFeedLabel = new QLabel(i18nc("@label:textbox", "Blog Feed"), this);
25 blogFeedLabel->setObjectName(QLatin1StringView("blogFeedLabel"));
26 topLayout->addWidget(blogFeedLabel);
27
28 mBlogFeed->setTrapReturnKey(true);
29 mBlogFeed->setPlaceholderText(i18nc("@info:placeholder", "Add a Blog Feed"));
30 mBlogFeed->setObjectName(QLatin1StringView("blogfeed"));
31 topLayout->addWidget(mBlogFeed);
32}
33
34BlogfeedWidget::~BlogfeedWidget() = default;
35
36void BlogfeedWidget::loadContact(const KContacts::Addressee &contact)
37{
38 mBlogFeed->setText(contact.blogFeed().url());
39}
40
41void BlogfeedWidget::storeContact(KContacts::Addressee &contact) const
42{
43 contact.setBlogFeed(QUrl(mBlogFeed->text().trimmed()));
44}
45
46void BlogfeedWidget::setReadOnly(bool readOnly)
47{
48 mBlogFeed->setReadOnly(readOnly);
49}
50
51#include "moc_blogfeedwidget.cpp"
void setBlogFeed(const QUrl &blogFeed)
QUrl blogFeed() const
virtual void setReadOnly(bool)
virtual void setText(const QString &)
QString i18nc(const char *context, const char *text, const TYPE &arg...)
A widget for editing the display name of a contact.
QString url(FormattingOptions options) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:08:08 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.