Added invite info frame for Friend Request Messages.

This commit is contained in:
defnax 2017-02-07 17:01:36 +01:00
parent 90594bc9a6
commit 9226ccc5ca
6 changed files with 320 additions and 10 deletions

View file

@ -67,6 +67,7 @@ MsgItem::MsgItem(FeedHolder *parent, uint32_t feedId, const std::string &msgId,
expandFrame->hide(); expandFrame->hide();
inviteFrame->hide();
updateItemStatic(); updateItemStatic();
updateItem(); updateItem();
@ -119,12 +120,15 @@ void MsgItem::updateItemStatic()
if (mi.msgflags & RS_MSG_USER_REQUEST) if (mi.msgflags & RS_MSG_USER_REQUEST)
{ {
title = QString::fromUtf8(mi.title.c_str()) + " " + tr("from") + " " + srcName; title = QString::fromUtf8(mi.title.c_str()) + " " + tr("from") + " " + srcName;
replyButton->setText(tr("Reply to invite"));
subjectLabel->hide(); subjectLabel->hide();
inviteFrame->show();
} }
else else
{ {
title = tr("Message From") + ": " + srcName; title = tr("Message From") + ": " + srcName;
sendinviteButton->hide(); sendinviteButton->hide();
inviteFrame->hide();
} }
} }
else else

View file

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>643</width> <width>707</width>
<height>146</height> <height>180</height>
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="MsgItemGLayout"> <layout class="QGridLayout" name="MsgItemGLayout">
@ -120,7 +120,7 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="0" rowspan="3"> <item row="0" column="0" rowspan="4">
<widget class="AvatarWidget" name="avatar"> <widget class="AvatarWidget" name="avatar">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
@ -189,7 +189,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1" colspan="2"> <item row="2" column="1" colspan="3">
<widget class="QLabel" name="subjectLabel"> <widget class="QLabel" name="subjectLabel">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
@ -205,7 +205,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1" colspan="3"> <item row="3" column="1" colspan="3">
<layout class="QHBoxLayout" name="buttonHLayout"> <layout class="QHBoxLayout" name="buttonHLayout">
<item> <item>
<widget class="QPushButton" name="sendinviteButton"> <widget class="QPushButton" name="sendinviteButton">
@ -332,6 +332,123 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="1" column="1" colspan="3">
<widget class="QFrame" name="inviteFrame">
<property name="palette">
<palette>
<active>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>178</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>178</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>178</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>178</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<layout class="QHBoxLayout" name="distantFrameHLayout">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item>
<widget class="QLabel" name="infoPixmap">
<property name="maximumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/info16.png</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="infoLabel">
<property name="text">
<string notr="true">You get Invite, accept request and send your own Certificate back</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -376,6 +493,7 @@
</customwidgets> </customwidgets>
<resources> <resources>
<include location="../images.qrc"/> <include location="../images.qrc"/>
<include location="../../../../RetroShare/RetroShare/retroshare-gui/src/gui/images.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

View file

@ -135,6 +135,7 @@ MessageWidget::MessageWidget(bool controlled, QWidget *parent, Qt::WindowFlags f
connect(ui.expandFilesButton, SIGNAL(clicked()), this, SLOT(togglefileview())); connect(ui.expandFilesButton, SIGNAL(clicked()), this, SLOT(togglefileview()));
connect(ui.downloadButton, SIGNAL(clicked()), this, SLOT(getallrecommended())); connect(ui.downloadButton, SIGNAL(clicked()), this, SLOT(getallrecommended()));
connect(ui.msgText, SIGNAL(anchorClicked(QUrl)), this, SLOT(anchorClicked(QUrl))); connect(ui.msgText, SIGNAL(anchorClicked(QUrl)), this, SLOT(anchorClicked(QUrl)));
connect(ui.sendinviteButton, SIGNAL(clicked()), this, SLOT(sendInvite()));
connect(NotifyQt::getInstance(), SIGNAL(messagesTagsChanged()), this, SLOT(messagesTagsChanged())); connect(NotifyQt::getInstance(), SIGNAL(messagesTagsChanged()), this, SLOT(messagesTagsChanged()));
connect(NotifyQt::getInstance(), SIGNAL(messagesChanged()), this, SLOT(messagesChanged())); connect(NotifyQt::getInstance(), SIGNAL(messagesChanged()), this, SLOT(messagesChanged()));
@ -173,6 +174,8 @@ MessageWidget::MessageWidget(bool controlled, QWidget *parent, Qt::WindowFlags f
} }
ui.dateText-> setText(""); ui.dateText-> setText("");
ui.inviteFrame->hide();
} }
MessageWidget::~MessageWidget() MessageWidget::~MessageWidget()
@ -479,6 +482,12 @@ void MessageWidget::fill(const std::string &msgId)
return; return;
} }
if (msgInfo.msgflags & RS_MSG_USER_REQUEST){
ui.inviteFrame->show();
} else {
ui.inviteFrame->hide();
}
const std::list<FileInfo> &recList = msgInfo.files; const std::list<FileInfo> &recList = msgInfo.files;
std::list<FileInfo>::const_iterator it; std::list<FileInfo>::const_iterator it;
@ -738,3 +747,20 @@ void MessageWidget::loadImagesAlways()
rsMail->MessageLoadEmbeddedImages(currMsgId, true); rsMail->MessageLoadEmbeddedImages(currMsgId, true);
} }
void MessageWidget::sendInvite()
{
MessageInfo mi;
if (!rsMail)
return;
if (!rsMail->getMessage(currMsgId, mi))
return;
if ((QMessageBox::question(this, tr("Send invite?"),tr("Do you really want send a invite with your Certificate?"),QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes))== QMessageBox::Yes)
{
MessageComposer::sendInvite(mi.rsgxsid_srcId);
}
}

View file

@ -69,6 +69,8 @@ private slots:
void printPreview(); void printPreview();
void saveAs(); void saveAs();
void refill(); void refill();
void sendInvite();
void msgfilelistWidgetCostumPopupMenu(QPoint); void msgfilelistWidgetCostumPopupMenu(QPoint);
void messagesTagsChanged(); void messagesTagsChanged();

View file

@ -288,11 +288,157 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QFrame" name="inviteFrame">
<property name="palette">
<palette>
<active>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>178</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>178</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>178</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>178</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<layout class="QHBoxLayout" name="distantFrameHLayout">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item>
<widget class="QLabel" name="infoPixmap">
<property name="maximumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/info16.png</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="infoLabel">
<property name="text">
<string notr="true">You get Invite, accept request and send your own Certificate back</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="sendinviteButton">
<property name="text">
<string>Send Invite</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item> <item>
<layout class="QHBoxLayout" name="_2"> <layout class="QHBoxLayout" name="_2">
<item> <item>
<layout class="QGridLayout" name="_3"> <layout class="QGridLayout" name="_3">
<property name="margin"> <property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<property name="spacing"> <property name="spacing">

View file

@ -439,10 +439,17 @@ PeerItem QLabel#peerNameLabel {
color: #990033 color: #990033
} }
MsgItem > QFrame#frame { MsgItem QFrame#frame {
border: 2px solid #3EA2FF; border: 2px solid #0099cc;
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #2291E0, stop: 1 #3EB3FF); border-radius: 6px;
border-radius: 10px; background: white;
}
MsgItem QFrame#inviteFrame {
border: 1px solid #DCDC41;
border-radius: 6px;
background: #FFFFD7;
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #FFFFD7, stop:1 #FFFFB2);
} }
MsgItem QWidget#avatar { MsgItem QWidget#avatar {
@ -553,6 +560,13 @@ MessageWidget QFrame#decryptFrame {
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #CCFFCC, stop:1 #AAFFAA); background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #CCFFCC, stop:1 #AAFFAA);
} }
MessageWidget QFrame#inviteFrame {
border: 1px solid #DCDC41;
border-radius: 6px;
background: #FFFFD7;
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #FFFFD7, stop:1 #FFFFB2);
}
/* Posted Links */ /* Posted Links */
PostedCreatePostDialog QLabel#info_label { PostedCreatePostDialog QLabel#info_label {