mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-18 20:34:26 -05:00
The AddFriend and InviteFriend dialogs changed, now they become more usable. I tried to make them simpler;
Changes: - Invitation text contains only certificate information; - buttons for saving/opening pqi-files become more noticeable; In our pogram this mechanism works fine, and there are no bugs with it. It ill be good to stimulate users to invite friends with this way. - removed "Email" button from invite dialog. There are other ways for transferring a piece of text: icq, irc, forums... Also, this button worked only on Windows, and, some people use web-based mail, not standard clients. I tried to make the dialog as simple, as possibe, so I removed unnessessary buttons git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1085 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
efd9a2f056
commit
a735928749
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
/** Default constructor */
|
/** Default constructor */
|
||||||
AddFriendDialog::AddFriendDialog(NetworkDialog *cd, QWidget *parent, Qt::WFlags flags)
|
AddFriendDialog::AddFriendDialog(NetworkDialog *cd, QWidget *parent, Qt::WFlags flags)
|
||||||
: QDialog(parent, flags), cDialog(cd)
|
: QDialog(parent, flags), cDialog(cd)
|
||||||
@ -42,19 +43,27 @@ AddFriendDialog::AddFriendDialog(NetworkDialog *cd, QWidget *parent, Qt::WFlags
|
|||||||
connect(ui.fileButton, SIGNAL(clicked()), this, SLOT(filebutton()));
|
connect(ui.fileButton, SIGNAL(clicked()), this, SLOT(filebutton()));
|
||||||
connect(ui.doneButton, SIGNAL(clicked()), this, SLOT(donebutton()));
|
connect(ui.doneButton, SIGNAL(clicked()), this, SLOT(donebutton()));
|
||||||
|
|
||||||
|
//maybe, it was already set somewere, but just in case. This settings should
|
||||||
|
//prevent some bugs...
|
||||||
|
ui.emailText->setLineWrapMode(QTextEdit::NoWrap);
|
||||||
|
ui.emailText->setAcceptRichText(false);
|
||||||
|
|
||||||
//setFixedSize(QSize(434, 462));
|
//setFixedSize(QSize(434, 462));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
void AddFriendDialog::donebutton()
|
void AddFriendDialog::donebutton()
|
||||||
{
|
{
|
||||||
/* something complicated ;) */
|
|
||||||
std::string id;
|
std::string id;
|
||||||
|
std::string certstr;
|
||||||
|
|
||||||
/* get the text from the window */
|
QString fn = ui.fileSelectEdit->text() ;
|
||||||
/* load into string */
|
if (fn.isEmpty())
|
||||||
std::string certstr = ui.emailText->toPlainText().toStdString();
|
{
|
||||||
|
//load certificate from text box
|
||||||
|
certstr = ui.emailText->toPlainText().toStdString();
|
||||||
|
|
||||||
/* ask retroshare to load */
|
|
||||||
if ((cDialog) && (rsPeers->LoadCertificateFromString(certstr, id)))
|
if ((cDialog) && (rsPeers->LoadCertificateFromString(certstr, id)))
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
@ -63,47 +72,72 @@ void AddFriendDialog::donebutton()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* error message */
|
/* error message */
|
||||||
int ret = QMessageBox::warning(this, tr("RetroShare"),
|
QMessageBox::warning(this, tr("RetroShare"),
|
||||||
tr("Certificate Load Failed"),
|
tr("Certificate Load Failed"),
|
||||||
QMessageBox::Ok, QMessageBox::Ok);
|
QMessageBox::Ok, QMessageBox::Ok);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void AddFriendDialog::afcancelbutton()
|
|
||||||
{
|
|
||||||
close();
|
close();
|
||||||
}
|
return;
|
||||||
|
|
||||||
|
|
||||||
void AddFriendDialog::filebutton()
|
|
||||||
{
|
|
||||||
|
|
||||||
/* show file dialog,
|
|
||||||
* load file into screen,
|
|
||||||
* push done button!
|
|
||||||
*/
|
|
||||||
std::string id;
|
|
||||||
if (cDialog)
|
|
||||||
{
|
|
||||||
id = cDialog->loadneighbour();
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* call make Friend */
|
else
|
||||||
if (id != "")
|
{
|
||||||
|
//=== try to load selected certificate file
|
||||||
|
if (QFile::exists(fn))
|
||||||
|
{
|
||||||
|
std::string fnstr = fn.toStdString();
|
||||||
|
if ( (cDialog) && (rsPeers->LoadCertificateFromFile(fnstr, id)) )
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
cDialog->showpeerdetails(id);
|
cDialog->showpeerdetails(id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* error message */
|
QString mbxmess =
|
||||||
int ret = QMessageBox::warning(this, tr("RetroShare"),
|
QString(tr("Certificate Load Failed:something is wrong with %1 "))
|
||||||
tr("Certificate Load Failed"),
|
.arg(fn);
|
||||||
QMessageBox::Ok, QMessageBox::Ok);
|
|
||||||
|
QMessageBox::warning(this, tr("RetroShare"),
|
||||||
|
mbxmess, QMessageBox::Ok, QMessageBox::Ok);
|
||||||
|
close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QString mbxmess =
|
||||||
|
QString(tr("Certificate Load Failed:file %1 not found"))
|
||||||
|
.arg(fn);
|
||||||
|
|
||||||
|
QMessageBox::warning(this, tr("RetroShare"),
|
||||||
|
mbxmess, QMessageBox::Ok, QMessageBox::Ok);
|
||||||
|
|
||||||
|
close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
|
void AddFriendDialog::afcancelbutton()
|
||||||
|
{
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
|
void AddFriendDialog::filebutton()
|
||||||
|
{
|
||||||
|
QString fileName =
|
||||||
|
QFileDialog::getOpenFileName(this, tr("Select Certificate"),
|
||||||
|
"", tr("Certificates (*.pqi *.pem)"));
|
||||||
|
|
||||||
|
if (!fileName.isNull())
|
||||||
|
ui.fileSelectEdit->setText(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
void AddFriendDialog::setInfo(std::string invite)
|
void AddFriendDialog::setInfo(std::string invite)
|
||||||
{
|
{
|
||||||
|
@ -5,111 +5,28 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>539</width>
|
<width>510</width>
|
||||||
<height>402</height>
|
<height>350</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle" >
|
||||||
<string>Add a Friend</string>
|
<string>Add a Friend</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" >
|
<layout class="QVBoxLayout" name="verticalLayout_3" >
|
||||||
<property name="margin" >
|
<item>
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing" >
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<item row="1" column="0" colspan="5" >
|
|
||||||
<widget class="QTextEdit" name="emailText" >
|
|
||||||
<property name="font" >
|
|
||||||
<font>
|
|
||||||
<family>Courier New</family>
|
|
||||||
<pointsize>10</pointsize>
|
|
||||||
<kerning>false</kerning>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="readOnly" >
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="html" >
|
|
||||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
|
||||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
|
||||||
p, li { white-space: pre-wrap; }
|
|
||||||
</style></head><body style=" font-family:'Courier New'; font-size:10pt; font-weight:400; font-style:normal;">
|
|
||||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"></p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="acceptRichText" >
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="2" >
|
|
||||||
<widget class="QPushButton" name="fileButton" >
|
|
||||||
<property name="minimumSize" >
|
|
||||||
<size>
|
|
||||||
<width>77</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text" >
|
|
||||||
<string>Load From File</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0" >
|
|
||||||
<widget class="QPushButton" name="afcancelButton" >
|
|
||||||
<property name="minimumSize" >
|
|
||||||
<size>
|
|
||||||
<width>77</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text" >
|
|
||||||
<string>Cancel</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="4" >
|
|
||||||
<widget class="QPushButton" name="doneButton" >
|
|
||||||
<property name="minimumSize" >
|
|
||||||
<size>
|
|
||||||
<width>77</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text" >
|
|
||||||
<string>Done</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1" >
|
|
||||||
<spacer>
|
|
||||||
<property name="orientation" >
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0" >
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="3" >
|
|
||||||
<spacer>
|
|
||||||
<property name="orientation" >
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0" >
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0" colspan="5" >
|
|
||||||
<widget class="QLabel" name="addfriendLabel" >
|
<widget class="QLabel" name="addfriendLabel" >
|
||||||
|
<property name="sizePolicy" >
|
||||||
|
<sizepolicy vsizetype="MinimumExpanding" hsizetype="Preferred" >
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize" >
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>74</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="maximumSize" >
|
<property name="maximumSize" >
|
||||||
<size>
|
<size>
|
||||||
<width>16777215</width>
|
<width>16777215</width>
|
||||||
@ -535,13 +452,13 @@ p, li { white-space: pre-wrap; }
|
|||||||
<string notr="true" >background-image: url(:/images/addfriendlabel.png)</string>
|
<string notr="true" >background-image: url(:/images/addfriendlabel.png)</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
p, li { white-space: pre-wrap; }
|
p, li { white-space: pre-wrap; }
|
||||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
|
</style></head><body style=" font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;">
|
||||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16pt; font-weight:600; color:#32cd32;">Add a new Friend</span></p>
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:9pt;"><span style=" font-size:16pt; font-weight:600; color:#32cd32;">Add a new Friend</span> </p>
|
||||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">To add a new Friend, cut and paste their email </p>
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:9pt;"> </p>
|
||||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">invitation into the box below, and click done.</p>
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:9pt;"> </p></body></html></string>
|
||||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> </p></body></html></string>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment" >
|
<property name="alignment" >
|
||||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
@ -551,13 +468,143 @@ p, li { white-space: pre-wrap; }
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2" >
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="fileSelectLabel" >
|
||||||
|
<property name="text" >
|
||||||
|
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
|
p, li { white-space: pre-wrap; }
|
||||||
|
</style></head><body style=" font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;">
|
||||||
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt;">To add a new friend, specify path to their sertificate file in the box below and click "Done".</span></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap" >
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout" >
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="fileSelectEdit" >
|
||||||
|
<property name="font" >
|
||||||
|
<font>
|
||||||
|
<pointsize>12</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="fileButton" >
|
||||||
|
<property name="minimumSize" >
|
||||||
|
<size>
|
||||||
|
<width>77</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Load...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="emailLabel" >
|
||||||
|
<property name="text" >
|
||||||
|
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
|
p, li { white-space: pre-wrap; }
|
||||||
|
</style></head><body style=" font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;">
|
||||||
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt;">Alternative way, you can copy </span><span style=" font-size:12pt;">and paste your friend's XPGP certificate into the box below. </span></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap" >
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTextEdit" name="emailText" >
|
||||||
|
<property name="font" >
|
||||||
|
<font>
|
||||||
|
<family>Liberation Mono</family>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="html" >
|
||||||
|
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
|
p, li { white-space: pre-wrap; }
|
||||||
|
</style></head><body style=" font-family:'Liberation Mono'; font-size:10pt; font-weight:400; font-style:normal;">
|
||||||
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New';"><span style=" font-family:'Sans Serif'; font-size:11pt;">-----BEGIN XPGP CERTIFICATE-----</span></p>
|
||||||
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:11pt;">MIICxQIBADCCAUkCAQAwHhcNMDkwMjI4MTgzODIyWhcNMTQwMjI3MTgzODIyWjCC</p>
|
||||||
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:11pt;">ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANuLs8PuMBipmcrNK/Xd8u/Y</p>
|
||||||
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:11pt;">9/gY5+F/M3OZ7O+UtNI72WpY61XX2P8M/0wyC0oDAzHv/wPH/lXphysBsF13ItC4</p>
|
||||||
|
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:11pt;"></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="acceptRichText" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2" >
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="afcancelButton" >
|
||||||
|
<property name="minimumSize" >
|
||||||
|
<size>
|
||||||
|
<width>77</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Cancel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer>
|
||||||
|
<property name="orientation" >
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0" >
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="doneButton" >
|
||||||
|
<property name="minimumSize" >
|
||||||
|
<size>
|
||||||
|
<width>77</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Done</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>fileButton</tabstop>
|
<tabstop>fileButton</tabstop>
|
||||||
<tabstop>doneButton</tabstop>
|
<tabstop>doneButton</tabstop>
|
||||||
<tabstop>afcancelButton</tabstop>
|
<tabstop>afcancelButton</tabstop>
|
||||||
<tabstop>emailText</tabstop>
|
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
@ -23,7 +23,9 @@
|
|||||||
|
|
||||||
#include "rsiface/rsiface.h"
|
#include "rsiface/rsiface.h"
|
||||||
#include "rsiface/rspeers.h"
|
#include "rsiface/rspeers.h"
|
||||||
#include <util/WidgetBackgroundImage.h>
|
//#include <util/WidgetBackgroundImage.h>
|
||||||
|
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
/** Default constructor */
|
/** Default constructor */
|
||||||
InviteDialog::InviteDialog(QWidget *parent, Qt::WFlags flags)
|
InviteDialog::InviteDialog(QWidget *parent, Qt::WFlags flags)
|
||||||
@ -35,71 +37,11 @@ InviteDialog::InviteDialog(QWidget *parent, Qt::WFlags flags)
|
|||||||
/* add a Background image for Invite a Friend Label */
|
/* add a Background image for Invite a Friend Label */
|
||||||
//WidgetBackgroundImage::setBackgroundImage(ui.invitefriendLabel, ":images/new-contact.png", WidgetBackgroundImage::AdjustHeight);
|
//WidgetBackgroundImage::setBackgroundImage(ui.invitefriendLabel, ":images/new-contact.png", WidgetBackgroundImage::AdjustHeight);
|
||||||
|
|
||||||
connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(cancelbutton()));
|
|
||||||
connect(ui.emailButton, SIGNAL(clicked()), this, SLOT(emailbutton()));
|
|
||||||
connect(ui.doneButton, SIGNAL(clicked()), this, SLOT(closebutton()));
|
|
||||||
connect(ui.sCertButton, SIGNAL(clicked()), this, SLOT(savecertbutton()));
|
connect(ui.sCertButton, SIGNAL(clicked()), this, SLOT(savecertbutton()));
|
||||||
|
|
||||||
//setFixedSize(QSize(434, 462));
|
//setFixedSize(QSize(434, 462));
|
||||||
}
|
}
|
||||||
|
|
||||||
void InviteDialog::closebutton()
|
|
||||||
{
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void InviteDialog::cancelbutton()
|
|
||||||
{
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* for Win32 only */
|
|
||||||
#if defined(Q_OS_WIN)
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void InviteDialog::emailbutton()
|
|
||||||
{
|
|
||||||
/* for Win32 only */
|
|
||||||
#if defined(Q_OS_WIN)
|
|
||||||
|
|
||||||
std::string mailstr = "mailto:";
|
|
||||||
|
|
||||||
mailstr += "?subject=RetroShare Invite";
|
|
||||||
mailstr += "&body=";
|
|
||||||
mailstr += ui.emailText->toPlainText().toStdString();
|
|
||||||
|
|
||||||
/* search and replace the end of lines with: "%0D%0A" */
|
|
||||||
|
|
||||||
std::cerr << "MAIL STRING:" << mailstr.c_str() << std::endl;
|
|
||||||
|
|
||||||
size_t loc;
|
|
||||||
while((loc = mailstr.find("\n")) != mailstr.npos)
|
|
||||||
{
|
|
||||||
/* sdfkasdflkjh */
|
|
||||||
mailstr.replace(loc, 1, "%0D%0A");
|
|
||||||
}
|
|
||||||
|
|
||||||
HINSTANCE hInst = ShellExecuteA(0,
|
|
||||||
"open",
|
|
||||||
mailstr.c_str(),
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
SW_SHOW);
|
|
||||||
|
|
||||||
if(reinterpret_cast<int>(hInst) <= 32)
|
|
||||||
{
|
|
||||||
/* error */
|
|
||||||
std::cerr << "ShellExecute Error: " << reinterpret_cast<int>(hInst);
|
|
||||||
std::cerr << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void InviteDialog::setInfo(std::string invite)
|
void InviteDialog::setInfo(std::string invite)
|
||||||
{
|
{
|
||||||
// ui.emailText->setCurrentFont(QFont("TypeWriter",10)) ;
|
// ui.emailText->setCurrentFont(QFont("TypeWriter",10)) ;
|
||||||
@ -110,8 +52,24 @@ void InviteDialog::setInfo(std::string invite)
|
|||||||
|
|
||||||
void InviteDialog::savecertbutton(void)
|
void InviteDialog::savecertbutton(void)
|
||||||
{
|
{
|
||||||
|
QString qdir = QFileDialog::getSaveFileName(this,
|
||||||
|
"Please choose a filename",
|
||||||
|
QDir::homePath(),
|
||||||
|
"RetroShare Certificate (*.pqi)");
|
||||||
|
|
||||||
QString qdir = QFileDialog::getSaveFileName(this, "Please choose a filename", QDir::homePath(), "RetroShare Certificate (*.pqi)");
|
if ( rsPeers->SaveCertificateToFile(rsPeers->getOwnId(), qdir.toStdString()) )
|
||||||
rsPeers->SaveCertificateToFile(rsPeers->getOwnId(), qdir.toStdString()); // save to file
|
{
|
||||||
|
QMessageBox::information(this, tr("RetroShare"),
|
||||||
|
tr("Certificate file successfully created"),
|
||||||
|
QMessageBox::Ok, QMessageBox::Ok);
|
||||||
|
//close the window after messagebox finished
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QMessageBox::information(this, tr("RetroShare"),
|
||||||
|
tr("Sorry, certificate file creation failed"),
|
||||||
|
QMessageBox::Ok, QMessageBox::Ok);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,9 +43,6 @@ public slots:
|
|||||||
protected:
|
protected:
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void closebutton();
|
|
||||||
void cancelbutton();
|
|
||||||
void emailbutton();
|
|
||||||
/// saves your certificate to file to send to friends
|
/// saves your certificate to file to send to friends
|
||||||
void savecertbutton();
|
void savecertbutton();
|
||||||
|
|
||||||
|
@ -6,57 +6,14 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>577</width>
|
<width>577</width>
|
||||||
<height>554</height>
|
<height>273</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle" >
|
||||||
<string>Invite a Friend</string>
|
<string>Invite a Friend</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" >
|
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||||
<property name="margin" >
|
<item>
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing" >
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<item row="2" column="2" >
|
|
||||||
<widget class="QPushButton" name="emailButton" >
|
|
||||||
<property name="minimumSize" >
|
|
||||||
<size>
|
|
||||||
<width>77</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text" >
|
|
||||||
<string>Launch Email</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0" colspan="7" >
|
|
||||||
<widget class="QTextEdit" name="emailText" >
|
|
||||||
<property name="font" >
|
|
||||||
<font>
|
|
||||||
<family>Courier New</family>
|
|
||||||
<pointsize>10</pointsize>
|
|
||||||
<kerning>false</kerning>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="readOnly" >
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="html" >
|
|
||||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
|
||||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
|
||||||
p, li { white-space: pre-wrap; }
|
|
||||||
</style></head><body style=" font-family:'Courier New'; font-size:10pt; font-weight:400; font-style:normal;">
|
|
||||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Arial'; font-size:8pt;"></p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="acceptRichText" >
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0" colspan="7" >
|
|
||||||
<widget class="QLabel" name="invitefriendLabel" >
|
<widget class="QLabel" name="invitefriendLabel" >
|
||||||
<property name="maximumSize" >
|
<property name="maximumSize" >
|
||||||
<size>
|
<size>
|
||||||
@ -483,99 +440,78 @@ p, li { white-space: pre-wrap; }
|
|||||||
<string notr="true" >background-image: url(:/images/invitefriendlabel.png);</string>
|
<string notr="true" >background-image: url(:/images/invitefriendlabel.png);</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
p, li { white-space: pre-wrap; }
|
p, li { white-space: pre-wrap; }
|
||||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
|
</style></head><body style=" font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;">
|
||||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Arial'; font-size:8pt;"><span style=" font-size:16pt; font-weight:600; color:#32cd32;">Invite a Friend</span><br /><span style=" font-size:10pt;">To Invite your friends to join you with Retroshare: </span></p>
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Arial'; font-size:8pt;"><span style=" font-size:16pt; font-weight:600; color:#32cd32;">Invite a Friend</span><br /><span style=" font-size:10pt;">To invite your friends to your retsoshare network you have to provide them your key. Just send them the text below</span></p>
|
||||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Arial'; font-size:10pt;">Cut and paste the text below into an email.</p>
|
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Arial';"></p></body></html></string>
|
||||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Arial'; font-size:10pt;">and send it to all your friends!</p></body></html></string>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment" >
|
<property name="alignment" >
|
||||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="wordWrap" >
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
<property name="indent" >
|
<property name="indent" >
|
||||||
<number>100</number>
|
<number>100</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" >
|
<item>
|
||||||
<widget class="QPushButton" name="cancelButton" >
|
<widget class="QTextEdit" name="emailText" >
|
||||||
<property name="minimumSize" >
|
<property name="font" >
|
||||||
<size>
|
<font>
|
||||||
<width>77</width>
|
<family>Courier New</family>
|
||||||
<height>0</height>
|
<pointsize>10</pointsize>
|
||||||
</size>
|
<kerning>false</kerning>
|
||||||
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="readOnly" >
|
||||||
<string>Cancel</string>
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="html" >
|
||||||
|
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
|
p, li { white-space: pre-wrap; }
|
||||||
|
</style></head><body style=" font-family:'Courier New'; font-size:10pt; font-weight:400; font-style:normal;">
|
||||||
|
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Arial'; font-size:8pt;"></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="acceptRichText" >
|
||||||
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1" >
|
<item>
|
||||||
<spacer>
|
<layout class="QHBoxLayout" name="horizontalLayout" >
|
||||||
<property name="orientation" >
|
<item>
|
||||||
<enum>Qt::Horizontal</enum>
|
<widget class="QLabel" name="fileSelectLabel" >
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0" >
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="6" >
|
|
||||||
<widget class="QPushButton" name="doneButton" >
|
|
||||||
<property name="minimumSize" >
|
|
||||||
<size>
|
|
||||||
<width>77</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Done</string>
|
<string>Alternatively, you can save the certificate information to a file. Please, press button to do this.</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap" >
|
||||||
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="4" >
|
<item>
|
||||||
<widget class="QPushButton" name="sCertButton" >
|
<widget class="QPushButton" name="sCertButton" >
|
||||||
|
<property name="sizePolicy" >
|
||||||
|
<sizepolicy vsizetype="MinimumExpanding" hsizetype="Fixed" >
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Save Cert To File</string>
|
<string>Save Cert To File</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="3" >
|
</layout>
|
||||||
<spacer>
|
|
||||||
<property name="orientation" >
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0" >
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="5" >
|
|
||||||
<spacer>
|
|
||||||
<property name="orientation" >
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0" >
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>emailButton</tabstop>
|
|
||||||
<tabstop>doneButton</tabstop>
|
|
||||||
<tabstop>cancelButton</tabstop>
|
|
||||||
<tabstop>emailText</tabstop>
|
<tabstop>emailText</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
Loading…
Reference in New Issue
Block a user