diff options
Diffstat (limited to 'Swift/QtUI/MUCSearch/MUCSearchEmptyItem.cpp')
-rw-r--r-- | Swift/QtUI/MUCSearch/MUCSearchEmptyItem.cpp | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/Swift/QtUI/MUCSearch/MUCSearchEmptyItem.cpp b/Swift/QtUI/MUCSearch/MUCSearchEmptyItem.cpp index f392859..3a3b841 100644 --- a/Swift/QtUI/MUCSearch/MUCSearchEmptyItem.cpp +++ b/Swift/QtUI/MUCSearch/MUCSearchEmptyItem.cpp @@ -1,38 +1,44 @@ /* - * Copyright (c) 2010 Remko Tronçon - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. + * Copyright (c) 2010-2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. */ #include <Swift/QtUI/MUCSearch/MUCSearchEmptyItem.h> -#include <Swift/QtUI/MUCSearch/MUCSearchServiceItem.h> -#include <QFont> +#include <memory> + #include <QColor> +#include <QFont> + +#include <Swift/QtUI/MUCSearch/MUCSearchServiceItem.h> namespace Swift { -MUCSearchEmptyItem::MUCSearchEmptyItem(MUCSearchServiceItem* parent) : parent(parent) { - parent->addRoom(this); +MUCSearchEmptyItem::MUCSearchEmptyItem() { +} + +void MUCSearchEmptyItem::setParent(std::weak_ptr<MUCSearchServiceItem> parent) { + parent_ = parent; } -MUCSearchServiceItem* MUCSearchEmptyItem::getParent() { - return parent; +std::shared_ptr<MUCSearchServiceItem> MUCSearchEmptyItem::getParent() { + return parent_.lock(); } QVariant MUCSearchEmptyItem::data(int role) { - switch (role) { - case Qt::DisplayRole: - return QVariant(QObject::tr("No rooms found")); - case Qt::FontRole: { - QFont font; - font.setItalic(true); - return font; - } - case Qt::ForegroundRole: - return QColor(Qt::gray); - default: - return QVariant(); - } + switch (role) { + case Qt::DisplayRole: + return QVariant(QObject::tr("No rooms found")); + case Qt::FontRole: { + QFont font; + font.setItalic(true); + return font; + } + case Qt::ForegroundRole: + return QColor(Qt::gray); + default: + return QVariant(); + } } } |