mirror of
https://gitlab.com/comunic/comunicmessages
synced 2025-06-20 00:45:17 +00:00
Get information about the members of the conversations.
This commit is contained in:
@ -1,5 +1,9 @@
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "conversationslistwidget.h"
|
||||
#include "../helpers/conversationslisthelper.h"
|
||||
#include "../helpers/usershelper.h"
|
||||
#include "../data/conversationslist.h"
|
||||
|
||||
ConversationsListWidget::ConversationsListWidget(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
@ -7,6 +11,10 @@ ConversationsListWidget::ConversationsListWidget(QWidget *parent) :
|
||||
//Create conversations helper
|
||||
mConversationsList = new ConversationsListHelper(this);
|
||||
connect(mConversationsList, &ConversationsListHelper::onGotList, this, &ConversationsListWidget::onGotConversationsList);
|
||||
|
||||
//Create users helper
|
||||
mUsersHelper = new UsersHelper(this);
|
||||
connect(mUsersHelper, &UsersHelper::onGotUsersInfo, this, &ConversationsListWidget::onGotUsersInfo);
|
||||
}
|
||||
|
||||
ConversationsListWidget::~ConversationsListWidget()
|
||||
@ -19,15 +27,26 @@ void ConversationsListWidget::refresh()
|
||||
mConversationsList->getList();
|
||||
}
|
||||
|
||||
void ConversationsListWidget::onGotConversationsList(bool success, const QList<Conversation> &list)
|
||||
void ConversationsListWidget::onGotConversationsList(bool success, const ConversationsList &list)
|
||||
{
|
||||
qWarning("Got conversations list (or failure).");
|
||||
qWarning("Got conversations list callback.");
|
||||
|
||||
if(!success)
|
||||
qWarning("Failure.");
|
||||
else {
|
||||
for(Conversation conv : list){
|
||||
qWarning("Conv %d : %s", conv.iD(), conv.name().toStdString().c_str());
|
||||
}
|
||||
if(!success){
|
||||
QMessageBox::warning(this, tr("Error"), tr("Could not get the list of conversations!"));
|
||||
return;
|
||||
}
|
||||
|
||||
//Get the list of users
|
||||
mUsersHelper->getList(list.getAllMembersId());
|
||||
}
|
||||
|
||||
void ConversationsListWidget::onGotUsersInfo(bool success, const QList<User> &users)
|
||||
{
|
||||
if(!success){
|
||||
QMessageBox::warning(this, tr("Error"), tr("Could not get information about the members of the conversations!"));
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug("Got the list of members of the conversations.");
|
||||
//TODO : use ConversationItemWidget
|
||||
}
|
||||
|
@ -3,9 +3,11 @@
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "../data/conversation.h"
|
||||
#include "../data/conversationslist.h"
|
||||
#include "../data/user.h"
|
||||
|
||||
class ConversationsListHelper;
|
||||
class UsersHelper;
|
||||
|
||||
class ConversationsListWidget : public QWidget
|
||||
{
|
||||
@ -28,10 +30,22 @@ private slots:
|
||||
* @param success TRUE for a success / FALSE else
|
||||
* @param list The list of conversation (empty list in case of failure)
|
||||
*/
|
||||
void onGotConversationsList(bool success, const QList<Conversation> &list);
|
||||
void onGotConversationsList(bool success, const ConversationsList &list);
|
||||
|
||||
/**
|
||||
* This slot is triggered once we have information about the users
|
||||
*
|
||||
* @param success TRUE in case of success / FALSE else
|
||||
* @param users The list of suers (empty list in case of failure)
|
||||
*/
|
||||
void onGotUsersInfo(bool success, const QList<User> &users);
|
||||
|
||||
private:
|
||||
ConversationsListHelper *mConversationsList;
|
||||
UsersHelper *mUsersHelper;
|
||||
|
||||
//Current conversation in cache
|
||||
ConversationsList mCurrList;
|
||||
};
|
||||
|
||||
#endif // CONVERSATIONSLISTWIDGET_H
|
||||
|
Reference in New Issue
Block a user