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

View File

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

View File

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

View File

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

View File

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