fixed bug in duplication of virtual dir names

This commit is contained in:
mr-alice 2016-11-01 11:11:28 +01:00
parent 761d595cb7
commit c6df59a421
2 changed files with 22 additions and 2 deletions

View File

@ -70,9 +70,8 @@ ShareManager::ShareManager()
connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(cancel()));
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(ui.shareddirList, SIGNAL(cellDoubleClicked(int,int)), this, SLOT(doubleClickedCell(int,int)));
connect(ui.shareddirList, SIGNAL(cellChanged(int,int)), this, SLOT(handleCellChange(int,int)));
connect(NotifyQt::getInstance(), SIGNAL(groupsChanged(int)), this, SLOT(reload()));
@ -87,6 +86,26 @@ ShareManager::ShareManager()
reload();
}
void ShareManager::handleCellChange(int row,int column)
{
if(isLoading)
return ;
if(column == COLUMN_VIRTUALNAME)
{
// check if the thing already exists
for(uint32_t i=0;i<mDirInfos.size();++i)
if(i != (uint32_t)row && (mDirInfos[row].virtualname == std::string(ui.shareddirList->item(i,COLUMN_VIRTUALNAME)->text().toUtf8())))
{
ui.shareddirList->item(row,COLUMN_VIRTUALNAME)->setText(QString::fromUtf8(mDirInfos[row].virtualname.c_str())) ;
return ;
}
mDirInfos[row].virtualname = std::string(ui.shareddirList->item(row,COLUMN_VIRTUALNAME)->text().toUtf8()) ;
}
}
void ShareManager::doubleClickedCell(int row,int column)
{
if(column == COLUMN_PATH)

View File

@ -58,6 +58,7 @@ private slots:
void shareddirListCostumPopupMenu( QPoint point );
void addShare();
void doubleClickedCell(int,int);
void handleCellChange(int row,int column);
void showShareDialog();
//void editShareDirectory();