Commit 2311f488 authored by Andreas Traczyk's avatar Andreas Traczyk
Browse files

SIP: draw sip contacts in the smartlist

Change-Id: I2603484d8a2fb158c439ff46acefbbcfedbb9ab5
parent 46fd3697
...@@ -351,25 +351,25 @@ CallWidget::setupSmartListContextMenu(const QPoint& pos) ...@@ -351,25 +351,25 @@ CallWidget::setupSmartListContextMenu(const QPoint& pos)
selectConversation(*conversation, *convModel); selectConversation(*conversation, *convModel);
} }
}); });
// clear conversation
auto clearConversationAction = new QAction(tr("Clear conversation"), this);
menu.addAction(clearConversationAction);
connect(clearConversationAction, &QAction::triggered,
[convUid]() {
LRCInstance::getCurrentConversationModel()->clearHistory(convUid);
});
// remove contact
auto removeContactAction = new QAction(tr("Remove contact"), this);
menu.addAction(removeContactAction);
connect(removeContactAction, &QAction::triggered,
[convUid]() {
LRCInstance::getCurrentConversationModel()->removeConversation(convUid, false);
});
if (contact.profileInfo.type == lrc::api::profile::Type::RING) { if (contact.profileInfo.type == lrc::api::profile::Type::RING) {
// separator // separator
menu.addSeparator(); menu.addSeparator();
// clear conversation
auto clearConversationAction = new QAction(tr("Clear conversation"), this);
menu.addAction(clearConversationAction);
connect(clearConversationAction, &QAction::triggered,
[convUid]() {
LRCInstance::getCurrentConversationModel()->clearHistory(convUid);
});
// remove contact
auto removeContactAction = new QAction(tr("Remove contact"), this);
menu.addAction(removeContactAction);
connect(removeContactAction, &QAction::triggered,
[convUid]() {
LRCInstance::getCurrentConversationModel()->removeConversation(convUid, false);
});
// block contact // block contact
auto blockContactAction = new QAction(tr("Block contact"), this); auto blockContactAction = new QAction(tr("Block contact"), this);
menu.addAction(blockContactAction); menu.addAction(blockContactAction);
......
...@@ -136,16 +136,15 @@ ConversationItemDelegate::paint(QPainter* painter ...@@ -136,16 +136,15 @@ ConversationItemDelegate::paint(QPainter* painter
); );
switch (type) { switch (type) {
case profile::Type::RING: case profile::Type::RING:
case profile::Type::SIP:
case profile::Type::TEMPORARY: case profile::Type::TEMPORARY:
paintRingConversationItem(painter, option, rect, index); paintConversationItem(painter, option, rect, index);
break; break;
case profile::Type::PENDING: case profile::Type::PENDING:
paintRingInviteConversationItem(painter, option, rect, index); paintRingInviteConversationItem(painter, option, rect, index);
break; break;
case profile::Type::SIP:
break;
default: default:
paintRingConversationItem(painter, option, rect, index); paintConversationItem(painter, option, rect, index);
break; break;
} }
} }
...@@ -160,10 +159,10 @@ ConversationItemDelegate::sizeHint(const QStyleOptionViewItem& option, ...@@ -160,10 +159,10 @@ ConversationItemDelegate::sizeHint(const QStyleOptionViewItem& option,
} }
void void
ConversationItemDelegate::paintRingConversationItem(QPainter* painter, ConversationItemDelegate::paintConversationItem(QPainter* painter,
const QStyleOptionViewItem& option, const QStyleOptionViewItem& option,
const QRect& rect, const QRect& rect,
const QModelIndex& index) const const QModelIndex& index) const
{ {
Q_UNUSED(option); Q_UNUSED(option);
QFont font(painter->font()); QFont font(painter->font());
...@@ -352,13 +351,3 @@ ConversationItemDelegate::paintRingInviteConversationItem(QPainter* painter, ...@@ -352,13 +351,3 @@ ConversationItemDelegate::paintRingInviteConversationItem(QPainter* painter,
painter->drawText(rectName2, Qt::AlignVCenter | Qt::AlignLeft, idStr); painter->drawText(rectName2, Qt::AlignVCenter | Qt::AlignLeft, idStr);
} }
} }
void
ConversationItemDelegate::paintSIPConversationItem(QPainter* painter,
const QStyleOptionViewItem& option,
const QModelIndex& index) const
{
Q_UNUSED(painter);
Q_UNUSED(option);
Q_UNUSED(index);
}
...@@ -34,9 +34,8 @@ protected: ...@@ -34,9 +34,8 @@ protected:
QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const; QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
private: private:
void paintRingConversationItem(QPainter* painter, const QStyleOptionViewItem& option, const QRect& rect, const QModelIndex& index) const; void paintConversationItem(QPainter* painter, const QStyleOptionViewItem& option, const QRect& rect, const QModelIndex& index) const;
void paintRingInviteConversationItem(QPainter* painter, const QStyleOptionViewItem& option, const QRect& rect, const QModelIndex& index) const; void paintRingInviteConversationItem(QPainter* painter, const QStyleOptionViewItem& option, const QRect& rect, const QModelIndex& index) const;
void paintSIPConversationItem(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
constexpr static int sizeImage_ = 48; constexpr static int sizeImage_ = 48;
constexpr static int cellHeight_ = 60; constexpr static int cellHeight_ = 60;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment