-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathselectmucroom.cpp
67 lines (61 loc) · 1.57 KB
/
selectmucroom.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include "selectmucroom.h"
#include "mucroom.h"
#include "ui_selectmucroom.h"
#include "listwindow.h"
#include <QMessageBox>
SelectMucroom::SelectMucroom(QWidget *parent) :
QDialog(parent),
ui(new Ui::SelectMucroom)
{
ui->setupUi(this);
Qt::WindowFlags flags=Qt::Dialog;
flags |=Qt::WindowMinimizeButtonHint |Qt::WindowMaximizeButtonHint;
setWindowFlags(flags);
bool check = connect(ui->Btt_confirm, SIGNAL(clicked()), this, SLOT(confirmClick()));
Q_ASSERT(check);
}
SelectMucroom::~SelectMucroom()
{
delete ui;
}
void SelectMucroom::confirmClick()
{
roomJID = ui->text_roomname->text();
//qDebug() << objectJID + "" + objectname;
QXmppMucRoom* room = NULL;
room = Listwindow::getMucmanager()->addRoom(roomJID);
if(!room)
{
return;
}
else{
if(objectJID == Listwindow::Instance()->getselfJID())
{
Mucroom* me = new Mucroom(0);
me->setparticipantNickname(objectJID);
me->joinroom(roomJID);
me->show();
}
else
{
bool check = room->sendInvitation(objectJID, "Pls add Chatroom" + roomJID);
if(!check)
{
QMessageBox::information(this, "Error", "Invatation Failure, Pls Try Again!");
}
else
{
qDebug() << "Invitation Success!";
}
}
this->close();
}
}
void SelectMucroom::tranobjectJID(QString JID)
{
objectJID = JID;
}
void SelectMucroom::tranobjectname(QString name)
{
objectname = name;
}