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 {
21  auto topLayout = new QVBoxLayout(this);
22  topLayout->setContentsMargins(0, 0, 0, 0);
23  topLayout->setObjectName(QStringLiteral("mainlayout"));
24  auto blogFeedLabel = new QLabel(i18n("Blog Feed"), this);
25  blogFeedLabel->setObjectName(QStringLiteral("blogFeedLabel"));
26  topLayout->addWidget(blogFeedLabel);
27 
28  mBlogFeed = new KLineEdit(this);
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()
36 {
37 }
38 
39 void BlogfeedWidget::loadContact(const KContacts::Addressee &contact)
40 {
41  mBlogFeed->setText(contact.blogFeed().url());
42 }
43 
44 void BlogfeedWidget::storeContact(KContacts::Addressee &contact) const
45 {
46  contact.setBlogFeed(QUrl(mBlogFeed->text().trimmed()));
47 }
48 
49 void BlogfeedWidget::setReadOnly(bool readOnly)
50 {
51  mBlogFeed->setReadOnly(readOnly);
52 }
QString url(QUrl::FormattingOptions options) const const
void setBlogFeed(const QUrl &blogFeed)
QUrl blogFeed() const
QString i18n(const char *text, const TYPE &arg...)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Wed Jun 23 2021 23:09:24 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.