Commit 1cf20c77 authored by Andreas Traczyk's avatar Andreas Traczyk

smartlist/callview: handle priority interactions

Change-Id: Ib8bb67c38fc9cd0231acd50cf204983c3272c9fd
parent d5424fdf
This diff is collapsed.
......@@ -75,7 +75,9 @@ public slots:
public slots:
void settingsButtonClicked();
void showIMOutOfCall(const QModelIndex& nodeIdx);
void showChatView(const QModelIndex& nodeIdx);
void showChatView(const std::string & accountId, const lrc::api::conversation::Info & convInfo);
void setupChatView(const lrc::api::conversation::Info& convInfo);
void slotAcceptInviteClicked(const QModelIndex& index);
void slotBlockInviteClicked(const QModelIndex& index);
void slotIgnoreInviteClicked(const QModelIndex& index);
......@@ -121,7 +123,7 @@ private:
bool connectConversationModel();
void updateConversationView(const std::string& convUid);
void showConversationView();
void selectSmartlistItem(const std::string& convUid);
bool selectSmartlistItem(const std::string& convUid);
QImage imageForConv(const std::string & convUid);
void processContactLineEdit();
void hideMiniSpinner();
......
......@@ -395,14 +395,13 @@ Utils::isContactValid(const std::string& contactUid, const lrc::api::Conversatio
QImage
Utils::conversationPhoto(const std::string & convUid, const lrc::api::account::Info& accountInfo)
{
auto& convModel = accountInfo.conversationModel;
auto conversation = Utils::getConversationFromUid(convUid, *convModel);
if (conversation == (*convModel).allFilteredConversations().end()) {
return QImage();
auto convInfo = getConversationFromUid(convUid, false);
if (!convInfo.uid.empty()) {
return GlobalInstances::pixmapManipulator()
.decorationRole(convInfo, accountInfo)
.value<QImage>();
}
QVariant var = GlobalInstances::pixmapManipulator().decorationRole(*conversation, accountInfo);
return var.value<QImage>();
return QImage();
}
QByteArray
......@@ -444,3 +443,32 @@ Utils::getConversationFromCallId(const std::string& callId)
}
return "";
}
lrc::api::conversation::Info
Utils::getSelectedConversation()
{
return getConversationFromUid(LRCInstance::getSelectedConvUid(), false);
}
lrc::api::conversation::Info
Utils::getConversationFromUid(const std::string & convUid, bool filtered)
{
auto convModel = LRCInstance::getCurrentConversationModel();
if (filtered) {
auto conversation = getConversationFromUid(convUid, *convModel);
} else {
using namespace lrc::api::profile;
for (int i = toUnderlyingValue(Type::RING); i <= toUnderlyingValue(Type::TEMPORARY); ++i) {
auto filter = toEnum<lrc::api::profile::Type>(i);
auto conversations = convModel->getFilteredConversations(filter);
auto conv = std::find_if(conversations.begin(), conversations.end(),
[&](const lrc::api::conversation::Info& conv) {
return convUid == conv.uid;
});
if (conv != conversations.end()) {
return *conv;
}
}
}
return lrc::api::conversation::Info();
}
......@@ -79,6 +79,8 @@ namespace Utils
QByteArray QByteArrayFromFile(const QString& filename);
QPixmap generateTintedPixmap(const QString& filename, QColor color);
std::string getConversationFromCallId(const std::string& callId);
lrc::api::conversation::Info getSelectedConversation();
lrc::api::conversation::Info getConversationFromUid(const std::string & convUid, bool filtered = true);
template <typename Func1, typename Func2>
void
......
Markdown is supported
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