little changes for AddFriendWizard

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@492 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2008-04-08 13:48:04 +00:00
parent cbaf3fffc9
commit 20c9e7d224
3 changed files with 98 additions and 24 deletions

View File

@ -19,30 +19,36 @@
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "AddFriendWizard.h"
//#include "rshare.h"
//#include "config/gconfig.h"
//#include "rsiface/rsiface.h"
#include "AddFriendWizard.h"
#include "rsiface/rsiface.h"
#include "rsiface/rspeers.h"
#include <sstream>
#include <QContextMenuEvent>
#include <QMenu>
#include <QCursor>
#include <QPoint>
#include <QMenu>
#include <QMessageBox>
#include <QMouseEvent>
#include <QPixmap>
#include <QPoint>
#include "gui/NetworkDialog.h"
/** Constructor */
AddFriendWizard::AddFriendWizard(QWidget *parent, Qt::WFlags flags)
: QDialog(parent, flags)
AddFriendWizard::AddFriendWizard(NetworkDialog *cd, QWidget *parent, Qt::WFlags flags)
: QDialog(parent, flags), cDialog(cd)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
//GConfig config;
//config.loadWidgetInformation(this);
//GConfig config;
//config.loadWidgetInformation(this);
connect(ui.loadfileButton, SIGNAL(clicked()), this, SLOT(loadfile()));
setFixedSize(QSize(508, 312));
@ -51,9 +57,29 @@ AddFriendWizard::AddFriendWizard(QWidget *parent, Qt::WFlags flags)
#ifdef Q_WS_WIN
#endif
}
/*!
* The destructor for AddFriendWizard
*/
AddFriendWizard::~AddFriendWizard()
{
}
void AddFriendWizard::reset(QSettings *settingsPointer)
{
// set the labelstackedWidget and textstackedWidget to the first position
//labelstackedWidget->setCurrentIndex(0);
ui.textstackedWidget->setCurrentIndex(0);
// disable the backButton: We don't need it if we are on the first position
ui.backButton->setEnabled(false);
// and we aren't at the last step, were the next button becomes the finish button
lastStep = false;
settings = settingsPointer;
}
void AddFriendWizard::on_nextButton_clicked()
@ -128,3 +154,31 @@ void AddFriendWizard::on_cancelButton_clicked()
// leave but show that cancel was pressed
reject();
}
void AddFriendWizard::loadfile()
{
/* show file dialog,
* load file into screen,
* push done button!
*/
std::string id;
if (cDialog)
{
id = cDialog->loadneighbour();
}
/* call make Friend */
if (id != "")
{
close();
cDialog->showpeerdetails(id);
}
else
{
/* error message */
int ret = QMessageBox::warning(this, tr("RetroShare"),
tr("Certificate Load Failed"),
QMessageBox::Ok, QMessageBox::Ok);
}
}

View File

@ -24,9 +24,11 @@
#define _ADDFRIENDWIZARD_H
#include <QDialog>
#include <QSettings>
#include "ui_AddFriendWizard.h"
class NetworkDialog;
class AddFriendWizard : public QDialog
{
@ -35,9 +37,11 @@ class AddFriendWizard : public QDialog
public:
/** Default Constructor */
AddFriendWizard(QWidget *parent = 0, Qt::WFlags flags = 0);
/** Default Destructor */
AddFriendWizard(NetworkDialog *cd, QWidget *parent = 0, Qt::WFlags flags = 0);
/** Default Destructor */
~AddFriendWizard();
void reset(QSettings *settingsPointer);
private slots:
@ -46,12 +50,18 @@ private slots:
void on_nextButton_clicked();
void on_backButton_clicked();
void on_cancelButton_clicked();
void loadfile();
private:
QSettings *settings;
bool lastStep;
NetworkDialog *cDialog;
/** Qt Designer generated object */
Ui::AddFriendWizard ui;

View File

@ -10,9 +10,7 @@
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -690,7 +688,7 @@ p, li { white-space: pre-wrap; }
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-weight:600;">Enter the Key code you got from your friend:&lt;/span>&lt;/p>&lt;/body>&lt;/html></string>
</property>
</widget>
<widget class="QTextBrowser" name="textBrowser" >
<widget class="QTextBrowser" name="keyText" >
<property name="geometry" >
<rect>
<x>10</x>
@ -748,17 +746,29 @@ p, li { white-space: pre-wrap; }
</rect>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<property name="leftMargin" >
<number>0</number>
</property>
<property name="spacing" >
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QLineEdit" name="lineEdit" />
</item>
<item row="0" column="1" >
<widget class="QPushButton" name="pushButton_4" >
<widget class="QPushButton" name="loadfileButton" >
<property name="text" >
<string>Browse</string>
</property>
@ -809,9 +819,9 @@ p, li { white-space: pre-wrap; }
<tabstop>keyradioButton</tabstop>
<tabstop>pqipemradioButton</tabstop>
<tabstop>inviteradioButton</tabstop>
<tabstop>textBrowser</tabstop>
<tabstop>keyText</tabstop>
<tabstop>lineEdit</tabstop>
<tabstop>pushButton_4</tabstop>
<tabstop>loadfileButton</tabstop>
<tabstop>emailText</tabstop>
</tabstops>
<resources>