mirror of
https://github.com/august-alt/gpui.git
synced 2025-03-14 12:58:39 +03:00
wip: add setDescription
method to rewrite logonLabel
text with names of script and policy
This commit is contained in:
parent
dc4c4a8a10
commit
5a227b46d8
@ -63,12 +63,14 @@ public:
|
||||
|
||||
QTreeView* treeView = nullptr;
|
||||
|
||||
bool isStartUpScripts = false;
|
||||
bool isStartUpScripts = false;
|
||||
bool isUserScriptsFlag = false;
|
||||
|
||||
template<typename TUi>
|
||||
void setItem(TUi *ui, ScriptItemContainer *item, bool startUpScriptsFlag)
|
||||
void setItem(TUi *ui, ScriptItemContainer *item, bool startUpScriptsFlag, bool userScriptsFlag)
|
||||
{
|
||||
isStartUpScripts = startUpScriptsFlag;
|
||||
isStartUpScripts = startUpScriptsFlag;
|
||||
isUserScriptsFlag = userScriptsFlag;
|
||||
|
||||
scriptsItemContainer = item;
|
||||
|
||||
|
@ -115,6 +115,8 @@ void ScriptsContentWidget::startDialog(const QModelIndex &index)
|
||||
!isMachineNamespace);
|
||||
}
|
||||
|
||||
dialog->setDescription(snapIn->d->mainWindow->getPolicyName());
|
||||
|
||||
QObject::connect(dialog, &ScriptsDialog::saveDataSignal, snapIn->d, &ScriptsSnapInPrivate::saveData);
|
||||
|
||||
QObject::connect(dialog, &ScriptsDialog::reloaddataSignal, snapIn->d, &ScriptsSnapInPrivate::reloadData);
|
||||
|
@ -94,6 +94,34 @@ void ScriptsDialog::setModels(ScriptsModel *scriptsModel, ScriptsModel *powerScr
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptsDialog::setDescription(const QString &policyName)
|
||||
{
|
||||
QString scriptName;
|
||||
|
||||
if (isUserScripts)
|
||||
{
|
||||
scriptName = std::move(isStartUpScripts ? tr("Logon") : tr("Logoff"));
|
||||
}
|
||||
else
|
||||
{
|
||||
scriptName = std::move(isStartUpScripts ? tr("Startup") : tr("Shutdown"));
|
||||
}
|
||||
|
||||
QString logonLabelText = tr("Script") + ": \"" + scriptName + "\" " + tr("for")
|
||||
+ (policyName.isEmpty() ? " " + tr("Default Domain Policy") : " \"" + policyName + "\"");
|
||||
|
||||
QLabel* logonLabel = ui->scriptsTab->findChild<QLabel *>("logonLabel");
|
||||
if (logonLabel)
|
||||
{
|
||||
logonLabel->setText(logonLabelText);
|
||||
}
|
||||
logonLabel = ui->powerShellScriptsTab->findChild<QLabel *>("logonLabel");
|
||||
if (logonLabel)
|
||||
{
|
||||
logonLabel->setText(logonLabelText);
|
||||
}
|
||||
}
|
||||
|
||||
ScriptItemContainer *ScriptsDialog::findItemContainer(ScriptsModel *model, std::string section)
|
||||
{
|
||||
auto containers = model->topItems();
|
||||
|
@ -56,6 +56,8 @@ public:
|
||||
~ScriptsDialog();
|
||||
|
||||
void setModels(ScriptsModel *scriptsModel, ScriptsModel *powerScriptsModel, bool isOnStartUp, bool isUser);
|
||||
|
||||
void setDescription(const QString &policyName);
|
||||
|
||||
private:
|
||||
template<typename TWidget>
|
||||
|
Loading…
x
Reference in New Issue
Block a user