mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 14:16:16 -04:00
Saved group ids instead of group names for the group-based file permissions.
Translated group names in Share Manager. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5796 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
786177eaf0
commit
59ed165c81
7 changed files with 122 additions and 47 deletions
|
@ -28,11 +28,14 @@
|
|||
|
||||
#include <retroshare/rsfiles.h>
|
||||
#include <retroshare/rstypes.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
|
||||
#include "ShareManager.h"
|
||||
#include "ShareDialog.h"
|
||||
#include "settings/rsharesettings.h"
|
||||
#include <gui/common/GroupFlagsWidget.h>
|
||||
#include "gui/common/GroupDefs.h"
|
||||
#include "gui/notifyqt.h"
|
||||
|
||||
/* Images for context menu icons */
|
||||
#define IMAGE_CANCEL ":/images/delete.png"
|
||||
|
@ -68,6 +71,8 @@ ShareManager::ShareManager()
|
|||
connect(ui.shareddirList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(shareddirListCostumPopupMenu(QPoint)));
|
||||
connect(ui.shareddirList, SIGNAL(currentCellChanged(int,int,int,int)), this, SLOT(shareddirListCurrentCellChanged(int,int,int,int)));
|
||||
|
||||
connect(NotifyQt::getInstance(), SIGNAL(groupsChanged(int)), this, SLOT(updateGroups()));
|
||||
|
||||
ui.editButton->setEnabled(false);
|
||||
ui.removeButton->setEnabled(false);
|
||||
|
||||
|
@ -133,17 +138,7 @@ void ShareManager::load()
|
|||
listWidget->setRowHeight(row, 32);
|
||||
listWidget->setCellWidget(row, COLUMN_SHARE_FLAGS, widget);
|
||||
|
||||
QString group_string ;
|
||||
int n=0;
|
||||
for(std::list<std::string>::const_iterator it2((*it).parent_groups.begin());it2!=(*it).parent_groups.end();++it2,++n)
|
||||
{
|
||||
if(n>0)
|
||||
group_string += ", " ;
|
||||
|
||||
group_string += QString::fromStdString(*it2) ;
|
||||
}
|
||||
|
||||
listWidget->setItem(row, COLUMN_GROUPS, new QTableWidgetItem(group_string)) ;
|
||||
listWidget->setItem(row, COLUMN_GROUPS, new QTableWidgetItem()) ;
|
||||
listWidget->item(row,COLUMN_GROUPS)->setBackgroundColor(QColor(183,236,181)) ;
|
||||
|
||||
connect(widget,SIGNAL(flagsChanged(FileStorageFlags)),this,SLOT(updateFlags())) ;
|
||||
|
@ -157,6 +152,7 @@ void ShareManager::load()
|
|||
update();
|
||||
|
||||
isLoading = false ;
|
||||
updateGroups();
|
||||
}
|
||||
|
||||
void ShareManager::showYourself()
|
||||
|
@ -206,6 +202,38 @@ void ShareManager::updateFlags()
|
|||
}
|
||||
}
|
||||
|
||||
void ShareManager::updateGroups()
|
||||
{
|
||||
if(isLoading)
|
||||
return ;
|
||||
|
||||
std::cerr << "Updating groups" << std::endl;
|
||||
|
||||
std::list<SharedDirInfo>::iterator it;
|
||||
std::list<SharedDirInfo> dirs;
|
||||
rsFiles->getSharedDirectories(dirs);
|
||||
|
||||
int row=0 ;
|
||||
for(it = dirs.begin(); it != dirs.end(); it++,++row)
|
||||
{
|
||||
QTableWidgetItem *item = ui.shareddirList->item(row, COLUMN_GROUPS);
|
||||
|
||||
QString group_string;
|
||||
int n = 0;
|
||||
for (std::list<std::string>::const_iterator it2((*it).parent_groups.begin());it2!=(*it).parent_groups.end();++it2,++n)
|
||||
{
|
||||
if (n>0)
|
||||
group_string += ", " ;
|
||||
|
||||
RsGroupInfo groupInfo;
|
||||
rsPeers->getGroupInfo(*it2, groupInfo);
|
||||
group_string += GroupDefs::name(groupInfo);
|
||||
}
|
||||
|
||||
item->setText(group_string);
|
||||
}
|
||||
}
|
||||
|
||||
void ShareManager::editShareDirectory()
|
||||
{
|
||||
/* id current dir */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue