-added remove Friend feature

-added Add Friend feature

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@251 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2007-11-17 01:35:52 +00:00
parent 23d1894b2b
commit 92d5c61c8c
2 changed files with 64 additions and 16 deletions

View File

@ -33,6 +33,8 @@
#include "util/PixmapMerging.h" #include "util/PixmapMerging.h"
#include "LogoBar.h" #include "LogoBar.h"
#include "util/Widget.h" #include "util/Widget.h"
#include "gui/connect/InviteDialog.h"
#include "gui/connect/AddFriendDialog.h"
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
@ -71,6 +73,8 @@ MessengerWindow::MessengerWindow(QWidget * parent)
connect( ui.messengertreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( messengertreeWidgetCostumPopupMenu( QPoint ) ) ); connect( ui.messengertreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( messengertreeWidgetCostumPopupMenu( QPoint ) ) );
connect( ui.avatarButton, SIGNAL(clicked()), SLOT(changeAvatarClicked())); connect( ui.avatarButton, SIGNAL(clicked()), SLOT(changeAvatarClicked()));
connect( ui.addIMAccountButton, SIGNAL(clicked( bool ) ), this , SLOT( addFriend2() ) );
/* to hide the header */ /* to hide the header */
ui.messengertreeWidget->header()->hide(); ui.messengertreeWidget->header()->hide();
@ -126,25 +130,26 @@ void MessengerWindow::messengertreeWidgetCostumPopupMenu( QPoint point )
exportfriendAct = new QAction(QIcon(IMAGE_EXPIORTFRIEND), tr( "Export Friend" ), this ); exportfriendAct = new QAction(QIcon(IMAGE_EXPIORTFRIEND), tr( "Export Friend" ), this );
connect( exportfriendAct , SIGNAL( triggered() ), this, SLOT( exportfriend2() ) ); connect( exportfriendAct , SIGNAL( triggered() ), this, SLOT( exportfriend2() ) );
removefriendAct = new QAction(QIcon(IMAGE_REMOVEFRIEND), tr( "Remove Friend" ), this );
connect( removefriendAct , SIGNAL( triggered() ), this, SLOT( removefriend2() ) );
* *
* *
*********/ *********/
removefriend2Act = new QAction(QIcon(IMAGE_REMOVEFRIEND), tr( "Remove Friend" ), this );
connect( removefriend2Act , SIGNAL( triggered() ), this, SLOT( removefriend2() ) );
contextMnu.clear(); contextMnu.clear();
contextMnu.addAction( chatAct); contextMnu.addAction( chatAct);
contextMnu.addAction( sendMessageAct); contextMnu.addAction( sendMessageAct);
contextMnu.addSeparator(); contextMnu.addSeparator();
contextMnu.addAction( connectfriendAct); contextMnu.addAction( connectfriendAct);
contextMnu.addAction( removefriend2Act);
/**** Do we want these options here??? /**** Do we want these options here???
* *
* *
contextMnu.addAction( configurefriendAct); contextMnu.addAction( configurefriendAct);
contextMnu.addAction( exportfriendAct); contextMnu.addAction( exportfriendAct);
contextMnu.addAction( removefriendAct);
* *
* *
****/ ****/
@ -263,11 +268,6 @@ void MessengerWindow::exportfriend2()
} }
void MessengerWindow::removefriend2()
{
}
void MessengerWindow::allowfriend2() void MessengerWindow::allowfriend2()
{ {
@ -431,6 +431,19 @@ QTreeWidgetItem *MessengerWindow::getCurrentPeer(bool &isOnline)
return item; return item;
} }
void MessengerWindow::removefriend2()
{
bool isOnline;
QTreeWidgetItem *c = getCurrentPeer(isOnline);
std::cerr << "MessengerWindow::removefriend2()" << std::endl;
if (!c)
{
std::cerr << "MessengerWindow::removefriend2() Noone Selected -- sorry" << std::endl;
return;
}
rsicontrol->FriendRemove(getMessengerPeerRsCertId(c));
}
void MessengerWindow::changeAvatarClicked() void MessengerWindow::changeAvatarClicked()
{ {
@ -438,6 +451,34 @@ void MessengerWindow::changeAvatarClicked()
} }
/** Add a Friend ShortCut */
void MessengerWindow::addFriend2()
{
/* call load Certificate */
#if 0
std::string id;
if (connectionsDialog)
{
id = connectionsDialog->loadneighbour();
}
/* call make Friend */
if (id != "")
{
connectionsDialog->showpeerdetails(id);
}
virtual int NeighLoadPEMString(std::string pem, std::string &id) = 0;
#else
static AddFriendDialog *addDialog2 =
new AddFriendDialog(networkDialog2, this);
std::string invite = "";
addDialog2->setInfo(invite);
addDialog2->show();
#endif
}
void MessengerWindow::updateAvatar() void MessengerWindow::updateAvatar()
{ {
std::string backgroundPixmapFilename = ":/images/retrosharelogo1.png"; std::string backgroundPixmapFilename = ":/images/retrosharelogo1.png";

View File

@ -25,6 +25,8 @@
#include "mainpage.h" #include "mainpage.h"
#include "ui_MessengerWindow.h" #include "ui_MessengerWindow.h"
#include "NetworkDialog.h"
class LogoBar; class LogoBar;
class ChatDialog; class ChatDialog;
@ -41,6 +43,9 @@ public:
void insertPeers(); void insertPeers();
void setChatDialog(ChatDialog *cd); void setChatDialog(ChatDialog *cd);
NetworkDialog *networkDialog2;
public slots: public slots:
/** Called when this dialog is to be displayed */ /** Called when this dialog is to be displayed */
@ -68,6 +73,8 @@ private slots:
void configurefriend2(); void configurefriend2();
void addFriend2();
/** RsServer Friend Calls */ /** RsServer Friend Calls */
void allowfriend2(); void allowfriend2();
void connectfriend2(); void connectfriend2();
@ -96,7 +103,7 @@ private:
QAction* connectfriendAct; QAction* connectfriendAct;
QAction* configurefriendAct; QAction* configurefriendAct;
QAction* exportfriendAct; QAction* exportfriendAct;
QAction* removefriendAct; QAction* removefriend2Act;
QTreeView *messengertreeWidget; QTreeView *messengertreeWidget;