UI: Programs: Services button is for admin access only

This commit is contained in:
Nodir Temirkhodjaev 2022-02-08 20:04:55 +03:00
parent 6d0046e4cb
commit 34ba701ba4
5 changed files with 19 additions and 3 deletions

View File

@ -4,6 +4,7 @@
#include <conf/confmanager.h>
#include <conf/firewallconf.h>
#include <fortmanager.h>
#include <fortsettings.h>
#include <manager/translationmanager.h>
#include <manager/windowmanager.h>
#include <model/applistmodel.h>
@ -21,6 +22,11 @@ FortManager *ProgramsController::fortManager() const
return IoC<FortManager>();
}
FortSettings *ProgramsController::settings() const
{
return IoC<FortSettings>();
}
ConfManager *ProgramsController::confManager() const
{
return IoC<ConfManager>();

View File

@ -8,6 +8,7 @@ class AppListModel;
class ConfManager;
class FirewallConf;
class FortManager;
class FortSettings;
class IniOptions;
class IniUser;
class TranslationManager;
@ -21,6 +22,7 @@ public:
explicit ProgramsController(QObject *parent = nullptr);
FortManager *fortManager() const;
FortSettings *settings() const;
ConfManager *confManager() const;
FirewallConf *conf() const;
IniOptions *ini() const;

View File

@ -40,6 +40,11 @@ ProgramsWindow::ProgramsWindow(QWidget *parent) :
setupStateWatcher();
}
FortSettings *ProgramsWindow::settings() const
{
return ctrl()->settings();
}
ConfManager *ProgramsWindow::confManager() const
{
return ctrl()->confManager();
@ -231,6 +236,7 @@ QLayout *ProgramsWindow::setupHeader()
// Services button
m_btServices = ControlUtil::createLinkButton(":/icons/windows-48.png");
m_btServices->setEnabled(settings()->hasMasterAdmin());
connect(m_btServices, &QAbstractButton::clicked, windowManager(),
&WindowManager::showServicesWindow);

View File

@ -12,6 +12,7 @@ class AppListModel;
class AppListModel;
class ConfManager;
class FirewallConf;
class FortSettings;
class IniOptions;
class IniUser;
class ProgramEditDialog;
@ -30,6 +31,7 @@ public:
explicit ProgramsWindow(QWidget *parent = nullptr);
ProgramsController *ctrl() const { return m_ctrl; }
FortSettings *settings() const;
ConfManager *confManager() const;
FirewallConf *conf() const;
IniOptions *ini() const;

View File

@ -73,7 +73,7 @@ void ServicesWindow::saveWindowState()
void ServicesWindow::restoreWindowState()
{
m_stateWatcher->restore(this, QSize(1024, 768), iniUser()->serviceWindowGeometry(),
m_stateWatcher->restore(this, QSize(800, 600), iniUser()->serviceWindowGeometry(),
iniUser()->serviceWindowMaximized());
if (iniUser()->servicesHeaderVersion() == SERVICES_HEADER_VERSION) {
@ -201,8 +201,8 @@ void ServicesWindow::setupTableServiceListHeader()
header->setSectionResizeMode(1, QHeaderView::Stretch);
header->setSectionResizeMode(2, QHeaderView::Interactive);
header->resizeSection(0, 250);
header->resizeSection(1, 350);
header->resizeSection(0, 180);
header->resizeSection(1, 520);
header->resizeSection(2, 100);
}