fixed reloading of ShareManager due to postModDirectories and made it reload after addign new share

This commit is contained in:
mr-alice 2016-09-18 21:41:18 +02:00
parent e4568a896f
commit ff4c43819e
4 changed files with 13 additions and 7 deletions

View File

@ -1111,7 +1111,6 @@ void p3FileDatabase::splitAndSendItem(RsFileListsSyncResponseItem *ritem)
RsFileListsSyncResponseItem *p3FileDatabase::recvAndRebuildItem(RsFileListsSyncResponseItem *ritem)
{
#warning make sure about how robust that is to disconnections, etc.
if(!(ritem->flags & RsFileListsItem::FLAGS_SYNC_PARTIAL ))
return ritem ;

View File

@ -756,7 +756,10 @@ void MainWindow::updateFriends()
void MainWindow::postModDirectories(bool update_local)
{
RSettingsWin::postModDirectories(update_local);
ShareManager::postModDirectories(update_local);
// Why would we need that?? The effect is to reset the flags while we're changing them, so it's really not
// a good idea.
//ShareManager::postModDirectories(update_local);
QCoreApplication::flush();
}

View File

@ -148,7 +148,7 @@ void ShareManager::load()
GroupFlagsWidget *widget = new GroupFlagsWidget(NULL,(*it).shareflags);
listWidget->setRowHeight(row, 32);
listWidget->setRowHeight(row, 32 * QFontMetricsF(font()).height()/14.0);
listWidget->setCellWidget(row, COLUMN_SHARE_FLAGS, widget);
listWidget->setItem(row, COLUMN_GROUPS, new QTableWidgetItem()) ;
@ -157,7 +157,7 @@ void ShareManager::load()
//connect(widget,SIGNAL(flagsChanged(FileStorageFlags)),this,SLOT(updateFlags())) ;
}
listWidget->setColumnWidth(COLUMN_SHARE_FLAGS,132) ;
listWidget->setColumnWidth(COLUMN_SHARE_FLAGS,132 * QFontMetricsF(font()).height()/14.0) ;
//ui.incomingDir->setText(QString::fromStdString(rsFiles->getDownloadDirectory()));
@ -282,6 +282,7 @@ void ShareManager::editShareDirectory()
ShareDialog sharedlg (it->filename, this);
sharedlg.setWindowTitle(tr("Edit Shared Folder"));
sharedlg.exec();
load();
break;
}
}
@ -318,6 +319,7 @@ void ShareManager::showShareDialog()
{
ShareDialog sharedlg ("", this);
sharedlg.exec();
load();
}
void ShareManager::shareddirListCurrentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn)
@ -387,4 +389,6 @@ void ShareManager::dropEvent(QDropEvent *event)
event->setDropAction(Qt::CopyAction);
event->accept();
load();
}

View File

@ -35,8 +35,8 @@ GroupFlagsWidget::GroupFlagsWidget(QWidget *parent,FileStorageFlags flags)
{
_layout = new QHBoxLayout(this) ;
setMinimumSize(128,32) ;
setMaximumSize(128,32) ;
setMinimumSize(128 * QFontMetricsF(font()).height()/14.0,32 * QFontMetricsF(font()).height()/14.0) ;
setMaximumSize(128 * QFontMetricsF(font()).height()/14.0,32 * QFontMetricsF(font()).height()/14.0) ;
setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
_icons[INDEX_GROUP_BROWSABLE] = new QIcon(FLAGS_GROUP_BROWSABLE_ICON) ;
@ -58,7 +58,7 @@ GroupFlagsWidget::GroupFlagsWidget(QWidget *parent,FileStorageFlags flags)
_buttons[i] = new QPushButton(this) ;
_buttons[i]->setCheckable(true) ;
_buttons[i]->setChecked(flags & _flags[i]) ;
_buttons[i]->setIconSize(QSize(32,32));
_buttons[i]->setIconSize(QSize(32 * QFontMetricsF(font()).height()/14.0,32 * QFontMetricsF(font()).height()/14.0));
update_button_state(_buttons[i]->isChecked(),i) ;
_layout->addWidget(_buttons[i]) ;
}