Sorted out the mess in friends list:

- removed entries from rightmost menu:
	* add friend: removed, already on the left bar
	* add group, recommendations and service perms => moved to context menu in friend list
	* create chat lobby: removed. Not relevant.
	* avatar and state string: removed. Can be done right at right, by clicking on the things.
- removed rightmost menu
- icons in context menu still need fixing.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6512 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2013-07-16 22:33:45 +00:00
parent 09971a06c6
commit 7c6a7edfde
5 changed files with 147 additions and 144 deletions

View File

@ -50,9 +50,9 @@
#include "util/misc.h" #include "util/misc.h"
#include "util/HandleRichText.h" #include "util/HandleRichText.h"
#include "util/DateTime.h" #include "util/DateTime.h"
#include "FriendRecommendDialog.h" //#include "FriendRecommendDialog.h"
#include "FriendsDialog.h" #include "FriendsDialog.h"
#include "ServicePermissionDialog.h" //#include "ServicePermissionDialog.h"
#include "NetworkView.h" #include "NetworkView.h"
#include "NetworkDialog.h" #include "NetworkDialog.h"
@ -168,18 +168,18 @@ FriendsDialog::FriendsDialog(QWidget *parent)
menu->addAction(ui.actionMessageHistory); menu->addAction(ui.actionMessageHistory);
ui.menuButton->setMenu(menu); ui.menuButton->setMenu(menu);
menu = new QMenu(); // menu = new QMenu();
menu->addAction(ui.actionAdd_Friend); // menu->addAction(ui.actionAdd_Friend);
menu->addAction(ui.actionAdd_Group); // menu->addAction(ui.actionAdd_Group);
menu->addAction(ui.actionCreate_new_Chat_lobby); // menu->addAction(ui.actionCreate_new_Chat_lobby);
menu->addAction(ui.actionFriendRecommendations); // menu->addAction(ui.actionFriendRecommendations);
menu->addAction(ui.actionServicePermission); // menu->addAction(ui.actionServicePermission);
//
menu->addSeparator(); // menu->addSeparator();
menu->addAction(ui.actionSet_your_Avatar); // menu->addAction(ui.actionSet_your_Avatar);
menu->addAction(ui.actionSet_your_Personal_Message); // menu->addAction(ui.actionSet_your_Personal_Message);
//
ui.menutoolButton->setMenu(menu); // ui.menutoolButton->setMenu(menu);
setAcceptDrops(true); setAcceptDrops(true);
ui.lineEdit->setAcceptDrops(false); ui.lineEdit->setAcceptDrops(false);
@ -859,11 +859,11 @@ void FriendsDialog::on_actionMessageHistory_triggered()
imBrowser.exec(); imBrowser.exec();
} }
void FriendsDialog::on_actionAdd_Group_activated() //void FriendsDialog::on_actionAdd_Group_activated()
{ //{
CreateGroup createGrpDialog ("", this); // CreateGroup createGrpDialog ("", this);
createGrpDialog.exec(); // createGrpDialog.exec();
} //}
// void FriendsDialog::newsFeedChanged(int count) // void FriendsDialog::newsFeedChanged(int count)
// { // {
@ -883,16 +883,16 @@ void FriendsDialog::on_actionAdd_Group_activated()
// } // }
// } // }
void FriendsDialog::recommendFriends() //void FriendsDialog::recommendFriends()
{ //{
FriendRecommendDialog::showYourself(); // FriendRecommendDialog::showYourself();
} //}
void FriendsDialog::servicePermission() //void FriendsDialog::servicePermission()
{ //{
ServicePermissionDialog dlg; // ServicePermissionDialog dlg;
dlg.exec(); // dlg.exec();
} //}
/*static*/ bool FriendsDialog::isGroupChatActive() /*static*/ bool FriendsDialog::isGroupChatActive()
{ {

View File

@ -112,7 +112,7 @@ private slots:
void getAvatar(); void getAvatar();
void on_actionAdd_Group_activated(); // void on_actionAdd_Group_activated();
void loadmypersonalstatus(); void loadmypersonalstatus();
@ -125,8 +125,8 @@ private slots:
//void newsFeedChanged(int count); //void newsFeedChanged(int count);
void recommendFriends(); // void recommendFriends();
void servicePermission(); // void servicePermission();
signals: signals:
void notifyGroupChat(const QString&,const QString&) ; void notifyGroupChat(const QString&,const QString&) ;

View File

@ -102,35 +102,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QToolButton" name="menutoolButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Add</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/edit_add24.png</normaloff>:/images/edit_add24.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>16</height>
</size>
</property>
<property name="popupMode">
<enum>QToolButton::InstantPopup</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View File

@ -31,8 +31,11 @@
#include "GroupDefs.h" #include "GroupDefs.h"
#include "gui/chat/ChatDialog.h" #include "gui/chat/ChatDialog.h"
#include "gui/chat/CreateLobbyDialog.h" //#include "gui/chat/CreateLobbyDialog.h"
#include "gui/common/AvatarDefs.h" #include "gui/common/AvatarDefs.h"
#include "gui/ServicePermissionDialog.h"
#include "gui/FriendRecommendDialog.h"
#include "gui/connect/ConfCertDialog.h" #include "gui/connect/ConfCertDialog.h"
#include "gui/connect/ConnectFriendWizard.h" #include "gui/connect/ConnectFriendWizard.h"
#include "gui/groups/CreateGroup.h" #include "gui/groups/CreateGroup.h"
@ -53,7 +56,7 @@
/* Images for context menu icons */ /* Images for context menu icons */
#define IMAGE_DENYFRIEND ":/images/denied16.png" #define IMAGE_DENYFRIEND ":/images/denied16.png"
#define IMAGE_REMOVEFRIEND ":/images/removefriend16.png" #define IMAGE_REMOVEFRIEND ":/images/remove_user24.png"
#define IMAGE_EXPORTFRIEND ":/images/user/friend_suggestion16.png" #define IMAGE_EXPORTFRIEND ":/images/user/friend_suggestion16.png"
#define IMAGE_ADDFRIEND ":/images/user/add_user16.png" #define IMAGE_ADDFRIEND ":/images/user/add_user16.png"
#define IMAGE_FRIENDINFO ":/images/peerdetails_16x16.png" #define IMAGE_FRIENDINFO ":/images/peerdetails_16x16.png"
@ -195,7 +198,8 @@ void FriendList::processSettings(bool bLoad)
// states // states
setHideUnconnected(Settings->value("hideUnconnected", mHideUnconnected).toBool()); setHideUnconnected(Settings->value("hideUnconnected", mHideUnconnected).toBool());
setHideState(Settings->value("hideState", mHideState).toBool()); setHideState(Settings->value("hideState", mHideState).toBool());
setRootIsDecorated(Settings->value("rootIsDecorated", ui->peerTreeWidget->rootIsDecorated()).toBool()); //setRootIsDecorated(Settings->value("rootIsDecorated", ui->peerTreeWidget->rootIsDecorated()).toBool());
setRootIsDecorated(true) ;
setShowGroups(Settings->value("showGroups", mShowGroups).toBool()); setShowGroups(Settings->value("showGroups", mShowGroups).toBool());
// open groups // open groups
@ -334,7 +338,7 @@ void FriendList::peerTreeWidgetCostumPopupMenu()
break; break;
} }
QMenu *lobbyMenu = NULL; // QMenu *lobbyMenu = NULL;
switch (type) { switch (type) {
case TYPE_GROUP: case TYPE_GROUP:
@ -342,7 +346,7 @@ void FriendList::peerTreeWidgetCostumPopupMenu()
bool standard = c->data(COLUMN_DATA, ROLE_STANDARD).toBool(); bool standard = c->data(COLUMN_DATA, ROLE_STANDARD).toBool();
contextMnu.addAction(QIcon(IMAGE_MSG), tr("Message Group"), this, SLOT(msgfriend())); contextMnu.addAction(QIcon(IMAGE_MSG), tr("Message Group"), this, SLOT(msgfriend()));
contextMnu.addAction(QIcon(IMAGE_ADDFRIEND), tr("Add Friend"), this, SLOT(addFriend())); // contextMnu.addAction(QIcon(IMAGE_ADDFRIEND), tr("Add Friend"), this, SLOT(addFriend()));
contextMnu.addSeparator(); contextMnu.addSeparator();
@ -351,14 +355,14 @@ void FriendList::peerTreeWidgetCostumPopupMenu()
QAction *action = contextMnu.addAction(QIcon(IMAGE_REMOVE), tr("Remove Group"), this, SLOT(removeGroup())); QAction *action = contextMnu.addAction(QIcon(IMAGE_REMOVE), tr("Remove Group"), this, SLOT(removeGroup()));
action->setDisabled(standard); action->setDisabled(standard);
lobbyMenu = contextMnu.addMenu(QIcon(IMAGE_CHAT), tr("Chat lobbies")) ; // lobbyMenu = contextMnu.addMenu(QIcon(IMAGE_CHAT), tr("Chat lobbies")) ;
} }
break; break;
case TYPE_GPG: case TYPE_GPG:
case TYPE_SSL: case TYPE_SSL:
{ {
contextMnu.addAction(QIcon(IMAGE_CHAT), tr("Chat"), this, SLOT(chatfriendproxy())); contextMnu.addAction(QIcon(IMAGE_CHAT), tr("Chat"), this, SLOT(chatfriendproxy()));
lobbyMenu = contextMnu.addMenu(QIcon(IMAGE_CHAT), tr("Chat lobbies")) ; // lobbyMenu = contextMnu.addMenu(QIcon(IMAGE_CHAT), tr("Chat lobbies")) ;
contextMnu.addAction(QIcon(IMAGE_MSG), tr("Message Friend"), this, SLOT(msgfriend())); contextMnu.addAction(QIcon(IMAGE_MSG), tr("Message Friend"), this, SLOT(msgfriend()));
@ -372,7 +376,7 @@ void FriendList::peerTreeWidgetCostumPopupMenu()
contextMnu.addAction(QIcon(IMAGE_EXPORTFRIEND), tr("Recommend this Friend to..."), this, SLOT(recommendfriend())); contextMnu.addAction(QIcon(IMAGE_EXPORTFRIEND), tr("Recommend this Friend to..."), this, SLOT(recommendfriend()));
} }
contextMnu.addAction(QIcon(IMAGE_CONNECT), tr("Connect To Friend"), this, SLOT(connectfriend())); contextMnu.addAction(QIcon(IMAGE_CONNECT), tr("Attempt to connect"), this, SLOT(connectfriend()));
if (type == TYPE_SSL) { if (type == TYPE_SSL) {
contextMnu.addAction(QIcon(IMAGE_COPYLINK), tr("Copy certificate link"), this, SLOT(copyFullCertificate())); contextMnu.addAction(QIcon(IMAGE_COPYLINK), tr("Copy certificate link"), this, SLOT(copyFullCertificate()));
@ -435,6 +439,8 @@ void FriendList::peerTreeWidgetCostumPopupMenu()
if (addToGroupMenu || moveToGroupMenu || foundGroup) { if (addToGroupMenu || moveToGroupMenu || foundGroup) {
QMenu *groupsMenu = contextMnu.addMenu(QIcon(IMAGE_GROUP16), tr("Groups")); QMenu *groupsMenu = contextMnu.addMenu(QIcon(IMAGE_GROUP16), tr("Groups"));
groupsMenu->addAction(QIcon(IMAGE_EXPAND), tr("Create new group"), this, SLOT(createNewGroup()));
if (addToGroupMenu) { if (addToGroupMenu) {
groupsMenu->addMenu(addToGroupMenu); groupsMenu->addMenu(addToGroupMenu);
} }
@ -460,36 +466,36 @@ void FriendList::peerTreeWidgetCostumPopupMenu()
} }
} }
if (lobbyMenu) { // if (lobbyMenu) {
lobbyMenu->addAction(QIcon(IMAGE_ADDFRIEND), tr("Create new"), this, SLOT(createchatlobby())); // lobbyMenu->addAction(QIcon(IMAGE_ADDFRIEND), tr("Create new"), this, SLOT(createchatlobby()));
// Get existing lobbies
// //
std::list<ChatLobbyInfo> cl_infos ; // // Get existing lobbies
rsMsgs->getChatLobbyList(cl_infos) ; // //
// std::list<ChatLobbyInfo> cl_infos ;
for(std::list<ChatLobbyInfo>::const_iterator it(cl_infos.begin());it!=cl_infos.end();++it) // rsMsgs->getChatLobbyList(cl_infos) ;
{ //
std::cerr << "Adding meny entry with lobby id " << std::hex << (*it).lobby_id << std::dec << std::endl; // for(std::list<ChatLobbyInfo>::const_iterator it(cl_infos.begin());it!=cl_infos.end();++it)
// {
QMenu *mnu2 = lobbyMenu->addMenu(QIcon(IMAGE_CHAT), QString::fromUtf8((*it).lobby_name.c_str())) ; // std::cerr << "Adding meny entry with lobby id " << std::hex << (*it).lobby_id << std::dec << std::endl;
//
QAction* inviteToLobbyAction = new QAction((type == TYPE_GROUP) ? tr("Invite this group") : tr("Invite this friend"), mnu2); // QMenu *mnu2 = lobbyMenu->addMenu(QIcon(IMAGE_CHAT), QString::fromUtf8((*it).lobby_name.c_str())) ;
inviteToLobbyAction->setData(QString::number((*it).lobby_id)); //
connect(inviteToLobbyAction, SIGNAL(triggered()), this, SLOT(inviteToLobby())); // QAction* inviteToLobbyAction = new QAction((type == TYPE_GROUP) ? tr("Invite this group") : tr("Invite this friend"), mnu2);
mnu2->addAction(inviteToLobbyAction); // inviteToLobbyAction->setData(QString::number((*it).lobby_id));
// connect(inviteToLobbyAction, SIGNAL(triggered()), this, SLOT(inviteToLobby()));
QAction* showLobbyAction = new QAction(tr("Show"), mnu2); // mnu2->addAction(inviteToLobbyAction);
showLobbyAction->setData(QString::number((*it).lobby_id)); //
connect(showLobbyAction, SIGNAL(triggered()), this, SLOT(showLobby())); // QAction* showLobbyAction = new QAction(tr("Show"), mnu2);
mnu2->addAction(showLobbyAction); // showLobbyAction->setData(QString::number((*it).lobby_id));
// connect(showLobbyAction, SIGNAL(triggered()), this, SLOT(showLobby()));
QAction* unsubscribeToLobbyAction = new QAction(tr("Unsubscribe"), mnu2); // mnu2->addAction(showLobbyAction);
unsubscribeToLobbyAction->setData(QString::number((*it).lobby_id)); //
connect(unsubscribeToLobbyAction, SIGNAL(triggered()), this, SLOT(unsubscribeToLobby())); // QAction* unsubscribeToLobbyAction = new QAction(tr("Unsubscribe"), mnu2);
mnu2->addAction(unsubscribeToLobbyAction); // unsubscribeToLobbyAction->setData(QString::number((*it).lobby_id));
} // connect(unsubscribeToLobbyAction, SIGNAL(triggered()), this, SLOT(unsubscribeToLobby()));
} // mnu2->addAction(unsubscribeToLobbyAction);
// }
// }
} else { } else {
QAction *action = contextMnu.addAction(QIcon(IMAGE_PASTELINK), tr("Paste Friend Link"), this, SLOT(pastePerson())); QAction *action = contextMnu.addAction(QIcon(IMAGE_PASTELINK), tr("Paste Friend Link"), this, SLOT(pastePerson()));
if (RSLinkClipboard::empty(RetroShareLink::TYPE_PERSON) && RSLinkClipboard::empty(RetroShareLink::TYPE_CERTIFICATE)) { if (RSLinkClipboard::empty(RetroShareLink::TYPE_PERSON) && RSLinkClipboard::empty(RetroShareLink::TYPE_CERTIFICATE)) {
@ -497,6 +503,12 @@ void FriendList::peerTreeWidgetCostumPopupMenu()
} }
} }
contextMnu.addSeparator();
contextMnu.addAction(QIcon(IMAGE_EXPAND), tr("Recommend many friends to each others"), this, SLOT(recommendFriends()));
contextMnu.addAction(QIcon(IMAGE_EXPAND), tr("Service permissions matrix"), this, SLOT(servicePermission()));
contextMnu.addSeparator(); contextMnu.addSeparator();
contextMnu.addAction(QIcon(IMAGE_EXPAND), tr("Expand all"), ui->peerTreeWidget, SLOT(expandAll())); contextMnu.addAction(QIcon(IMAGE_EXPAND), tr("Expand all"), ui->peerTreeWidget, SLOT(expandAll()));
@ -504,6 +516,21 @@ void FriendList::peerTreeWidgetCostumPopupMenu()
contextMnu.exec(QCursor::pos()); contextMnu.exec(QCursor::pos());
} }
void FriendList::createNewGroup()
{
CreateGroup createGrpDialog ("", this);
createGrpDialog.exec();
}
void FriendList::recommendFriends()
{
FriendRecommendDialog::showYourself();
}
void FriendList::servicePermission()
{
ServicePermissionDialog dlg;
dlg.exec();
}
void FriendList::updateDisplay() void FriendList::updateDisplay()
{ {
@ -1473,35 +1500,35 @@ void FriendList::configurefriend()
ConfCertDialog::showIt(getRsId(getCurrentPeer()), ConfCertDialog::PageDetails); ConfCertDialog::showIt(getRsId(getCurrentPeer()), ConfCertDialog::PageDetails);
} }
void FriendList::showLobby() // void FriendList::showLobby()
{ // {
std::string lobby_id = qobject_cast<QAction*>(sender())->data().toString().toStdString(); // std::string lobby_id = qobject_cast<QAction*>(sender())->data().toString().toStdString();
//
if (lobby_id.empty()) // if (lobby_id.empty())
return; // return;
//
std::string vpeer_id; // std::string vpeer_id;
//
if (rsMsgs->getVirtualPeerId(ChatLobbyId(QString::fromStdString(lobby_id).toULongLong()), vpeer_id)) // if (rsMsgs->getVirtualPeerId(ChatLobbyId(QString::fromStdString(lobby_id).toULongLong()), vpeer_id))
ChatDialog::chatFriend(vpeer_id); // ChatDialog::chatFriend(vpeer_id);
} // }
//
void FriendList::unsubscribeToLobby() // void FriendList::unsubscribeToLobby()
{ // {
std::string lobby_id = qobject_cast<QAction*>(sender())->data().toString().toStdString(); // std::string lobby_id = qobject_cast<QAction*>(sender())->data().toString().toStdString();
//
if (lobby_id.empty()) // if (lobby_id.empty())
return; // return;
//
std::string vpeer_id ; // std::string vpeer_id ;
rsMsgs->getVirtualPeerId (ChatLobbyId(QString::fromStdString(lobby_id).toULongLong()), vpeer_id); // rsMsgs->getVirtualPeerId (ChatLobbyId(QString::fromStdString(lobby_id).toULongLong()), vpeer_id);
//
if (QMessageBox::Ok == QMessageBox::question(this,tr("Unsubscribe to lobby"),tr("You are about to unsubscribe a chat lobby<br>You can only re-enter if your friends invite you again."),QMessageBox::Ok | QMessageBox::Cancel)) // if (QMessageBox::Ok == QMessageBox::question(this,tr("Unsubscribe to lobby"),tr("You are about to unsubscribe a chat lobby<br>You can only re-enter if your friends invite you again."),QMessageBox::Ok | QMessageBox::Cancel))
rsMsgs->unsubscribeChatLobby(ChatLobbyId(QString::fromStdString(lobby_id).toULongLong())) ; // rsMsgs->unsubscribeChatLobby(ChatLobbyId(QString::fromStdString(lobby_id).toULongLong())) ;
//
// we should also close existing windows. // // we should also close existing windows.
ChatDialog::closeChat(vpeer_id); // ChatDialog::closeChat(vpeer_id);
} // }
void FriendList::getSslIdsFromItem(QTreeWidgetItem *item, std::list<std::string> &sslIds) void FriendList::getSslIdsFromItem(QTreeWidgetItem *item, std::list<std::string> &sslIds)
{ {
@ -1532,6 +1559,7 @@ void FriendList::getSslIdsFromItem(QTreeWidgetItem *item, std::list<std::string>
} }
} }
#ifdef TO_REMOVE
void FriendList::inviteToLobby() void FriendList::inviteToLobby()
{ {
QTreeWidgetItem *c = getCurrentPeer(); QTreeWidgetItem *c = getCurrentPeer();
@ -1565,6 +1593,7 @@ void FriendList::createchatlobby()
CreateLobbyDialog(sslIds).exec(); CreateLobbyDialog(sslIds).exec();
} }
#endif
void FriendList::addToGroup() void FriendList::addToGroup()
{ {
@ -1930,28 +1959,28 @@ QMenu *FriendList::createDisplayMenu()
QMenu *displayMenu = new QMenu(this); QMenu *displayMenu = new QMenu(this);
connect(displayMenu, SIGNAL(aboutToShow()), this, SLOT(updateMenu())); connect(displayMenu, SIGNAL(aboutToShow()), this, SLOT(updateMenu()));
displayMenu->addAction(ui->actionSortPeersDescendingOrder); // displayMenu->addAction(ui->actionSortPeersDescendingOrder);
displayMenu->addAction(ui->actionSortPeersAscendingOrder); // displayMenu->addAction(ui->actionSortPeersAscendingOrder);
QMenu *menu = displayMenu->addMenu(tr("Columns")); QMenu *menu = displayMenu->addMenu(tr("Columns"));
menu->addAction(ui->actionShowAvatarColumn); menu->addAction(ui->actionShowAvatarColumn);
menu->addAction(ui->actionShowLastContactColumn); menu->addAction(ui->actionShowLastContactColumn);
menu->addAction(ui->actionShowIPColumn); menu->addAction(ui->actionShowIPColumn);
menu->addAction(ui->actionShowStatusColumn); menu->addAction(ui->actionShowStatusColumn);
menu = displayMenu->addMenu(tr("Sort by")); // menu = displayMenu->addMenu(tr("Sort by"));
menu->addAction(ui->actionSortByName); // menu->addAction(ui->actionSortByName);
menu->addAction(ui->actionSortByState); // menu->addAction(ui->actionSortByState);
menu->addAction(ui->actionSortByLastContact); // menu->addAction(ui->actionSortByLastContact);
menu->addAction(ui->actionSortByIP); // menu->addAction(ui->actionSortByIP);
displayMenu->addAction(ui->actionHideOfflineFriends); displayMenu->addAction(ui->actionHideOfflineFriends);
displayMenu->addAction(ui->actionHideState); displayMenu->addAction(ui->actionHideState);
displayMenu->addAction(ui->actionRootIsDecorated); // displayMenu->addAction(ui->actionRootIsDecorated);
displayMenu->addAction(ui->actionShowGroups); displayMenu->addAction(ui->actionShowGroups);
QActionGroup *group = new QActionGroup(this); // QActionGroup *group = new QActionGroup(this);
group->addAction(ui->actionSortByName); // group->addAction(ui->actionSortByName);
group->addAction(ui->actionSortByState); // group->addAction(ui->actionSortByState);
group->addAction(ui->actionSortByLastContact); // group->addAction(ui->actionSortByLastContact);
group->addAction(ui->actionSortByIP); // group->addAction(ui->actionSortByIP);
return displayMenu; return displayMenu;
} }

View File

@ -148,6 +148,9 @@ private slots:
#ifdef UNFINISHED_FD #ifdef UNFINISHED_FD
void viewprofile(); void viewprofile();
#endif #endif
void servicePermission() ;
void recommendFriends() ;
void createNewGroup() ;
void addToGroup(); void addToGroup();
void moveToGroup(); void moveToGroup();
@ -156,10 +159,10 @@ private slots:
void editGroup(); void editGroup();
void removeGroup(); void removeGroup();
void inviteToLobby(); // void inviteToLobby();
void createchatlobby(); // void createchatlobby();
void unsubscribeToLobby(); // void unsubscribeToLobby();
void showLobby(); // void showLobby();
}; };
#endif // FRIENDLIST_H #endif // FRIENDLIST_H