fixed two bugs in ShareManager popup menu

This commit is contained in:
mr-alice 2016-11-03 20:26:35 +01:00
parent 29b5bfe049
commit 8653649132
2 changed files with 15 additions and 6 deletions

View File

@ -69,7 +69,7 @@ ShareManager::ShareManager()
connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(applyAndClose())); connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(applyAndClose()));
connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(cancel())); connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(cancel()));
connect(ui.shareddirList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(shareddirListCostumPopupMenu(QPoint))); connect(ui.shareddirList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(shareddirListCustomPopupMenu(QPoint)));
connect(ui.shareddirList, SIGNAL(cellDoubleClicked(int,int)), this, SLOT(doubleClickedCell(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(ui.shareddirList, SIGNAL(cellChanged(int,int)), this, SLOT(handleCellChange(int,int)));
@ -106,6 +106,14 @@ void ShareManager::handleCellChange(int row,int column)
} }
} }
void ShareManager::editShareDirectory()
{
QTableWidget *listWidget = ui.shareddirList;
int row = listWidget -> currentRow();
doubleClickedCell(row,COLUMN_PATH) ;
}
void ShareManager::doubleClickedCell(int row,int column) void ShareManager::doubleClickedCell(int row,int column)
{ {
if(column == COLUMN_PATH) if(column == COLUMN_PATH)
@ -158,7 +166,7 @@ void ShareManager::applyAndClose()
close() ; close() ;
} }
void ShareManager::shareddirListCostumPopupMenu( QPoint /*point*/ ) void ShareManager::shareddirListCustomPopupMenu( QPoint /*point*/ )
{ {
QMenu contextMnu( this ); QMenu contextMnu( this );
@ -300,9 +308,10 @@ void ShareManager::removeShareDirectory()
{ {
if ((QMessageBox::question(this, tr("Warning!"),tr("Do you really want to stop sharing this directory ?"),QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes))== QMessageBox::Yes) if ((QMessageBox::question(this, tr("Warning!"),tr("Do you really want to stop sharing this directory ?"),QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes))== QMessageBox::Yes)
{ {
for(uint32_t i=row;i+1<mDirInfos.size();++i) for(uint32_t i=row;i+1<mDirInfos.size();++i)
mDirInfos[i] = mDirInfos[i+1] ; mDirInfos[i] = mDirInfos[i+1] ;
mDirInfos.pop_back() ;
load(); load();
} }
} }

View File

@ -55,13 +55,13 @@ protected:
private slots: private slots:
/** Create the context popup menu and it's submenus */ /** Create the context popup menu and it's submenus */
void shareddirListCurrentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn); void shareddirListCurrentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn);
void shareddirListCostumPopupMenu( QPoint point ); void shareddirListCustomPopupMenu( QPoint point );
void addShare(); void addShare();
void doubleClickedCell(int,int); void doubleClickedCell(int,int);
void handleCellChange(int row,int column); void handleCellChange(int row,int column);
void editShareDirectory();
void showShareDialog(); void showShareDialog();
//void editShareDirectory();
void removeShareDirectory(); void removeShareDirectory();
void updateFlags(); void updateFlags();
void applyAndClose() ; void applyAndClose() ;