mirror of
https://github.com/august-alt/gpui.git
synced 2025-03-13 08:58:39 +03:00
fix, wip: set default user context flag to true in user policies
This commit is contained in:
parent
f52c468197
commit
7f74dc33ed
@ -108,6 +108,7 @@ QVariant PreferencesTreeProxyModel::data(const QModelIndex &proxyIndex, int role
|
||||
|
||||
std::function<QWidget *()> widgetCreator = [=]() {
|
||||
auto contentWidget = new TableDetailsWidget();
|
||||
contentWidget->setModelType(isMachineModel ? 0 : 1);
|
||||
|
||||
auto item = viewModel->sessionItemFromIndex(proxyIndex);
|
||||
|
||||
|
@ -21,6 +21,8 @@
|
||||
#include "tabledetailswidget.h"
|
||||
#include "ui_tabledetailswidget.h"
|
||||
|
||||
#include "common/commonitem.h"
|
||||
|
||||
#include "common/preferencesdialog.h"
|
||||
#include "interfaces/containeriteminterface.h"
|
||||
#include "shortcuts/shortcutscontaineritem.h"
|
||||
@ -42,6 +44,7 @@ TableDetailsWidget::TableDetailsWidget(QWidget *parent)
|
||||
, delegate(std::make_unique<ModelView::ViewModelDelegate>())
|
||||
, mapper(nullptr)
|
||||
, itemTypes()
|
||||
, modelType(0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
@ -66,6 +69,11 @@ void TableDetailsWidget::setModel(ModelView::SessionModel *model)
|
||||
ui->treeView->setCurrentIndex(view_model->index(0, 0));
|
||||
}
|
||||
|
||||
void TableDetailsWidget::setModelType(int newModelType)
|
||||
{
|
||||
modelType = newModelType;
|
||||
}
|
||||
|
||||
void TableDetailsWidget::onItemTypeChange(const std::map<std::string, QString> &newItemTypes)
|
||||
{
|
||||
itemTypes = newItemTypes;
|
||||
@ -124,6 +132,9 @@ void TableDetailsWidget::on_treeView_customContextMenuRequested(const QPoint &po
|
||||
{
|
||||
containerItemInterface->setupListeners();
|
||||
}
|
||||
|
||||
newItem->children()[newItem->childrenCount() - 2]->setProperty<bool>(CommonItem::propertyToString(CommonItem::USER_CONTEXT), modelType == 1);
|
||||
|
||||
auto preferencesDialog = new PreferencesDialog(newItem, this);
|
||||
connect(preferencesDialog, &QDialog::rejected, [&]() {
|
||||
view_model->sessionModel()->removeItem(newItem->parent(), newItem->tagRow());
|
||||
|
@ -49,6 +49,7 @@ public:
|
||||
~TableDetailsWidget() override;
|
||||
|
||||
void setModel(ModelView::SessionModel *model);
|
||||
void setModelType(int newModelType);
|
||||
|
||||
signals:
|
||||
void okPressed();
|
||||
@ -78,6 +79,8 @@ private:
|
||||
std::unique_ptr<QDataWidgetMapper> mapper;
|
||||
|
||||
std::map<std::string, QString> itemTypes;
|
||||
|
||||
int modelType;
|
||||
};
|
||||
|
||||
} // namespace preferences
|
||||
|
Loading…
x
Reference in New Issue
Block a user