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 "../utils/utils.h"
11 #include <KContacts/Addressee>
12 #include <KLineEdit>
13 #include <KLocalizedString>
14 #include <QLabel>
15 #include <QVBoxLayout>
16 using namespace ContactEditor;
17 
18 BlogfeedWidget::BlogfeedWidget(QWidget *parent)
19  : QWidget(parent)
20  , mBlogFeed(new KLineEdit(this))
21 {
22  auto topLayout = new QVBoxLayout(this);
23  topLayout->setContentsMargins({});
24  topLayout->setObjectName(QStringLiteral("mainlayout"));
25  auto blogFeedLabel = new QLabel(i18n("Blog Feed"), this);
26  blogFeedLabel->setObjectName(QStringLiteral("blogFeedLabel"));
27  topLayout->addWidget(blogFeedLabel);
28 
29  mBlogFeed->setTrapReturnKey(true);
30  mBlogFeed->setPlaceholderText(i18n("Add a Blog Feed"));
31  mBlogFeed->setObjectName(QStringLiteral("blogfeed"));
32  topLayout->addWidget(mBlogFeed);
33 }
34 
35 BlogfeedWidget::~BlogfeedWidget() = default;
36 
37 void BlogfeedWidget::loadContact(const KContacts::Addressee &contact)
38 {
39  mBlogFeed->setText(contact.blogFeed().url());
40 }
41 
42 void BlogfeedWidget::storeContact(KContacts::Addressee &contact) const
43 {
44  contact.setBlogFeed(QUrl(mBlogFeed->text().trimmed()));
45 }
46 
47 void BlogfeedWidget::setReadOnly(bool readOnly)
48 {
49  mBlogFeed->setReadOnly(readOnly);
50 }
QString url(QUrl::FormattingOptions options) const const
QString i18n(const char *text, const TYPE &arg...)
QUrl blogFeed() const
void setBlogFeed(const QUrl &blogFeed)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Apr 1 2023 04:09:04 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.