[PC-BSD Commits] r7248 - pcbsd/current/ServiceManager
svn at pcbsd.org
svn at pcbsd.org
Wed Jul 21 12:43:48 PDT 2010
Author: kris
Date: 2010-07-21 12:43:48 -0700 (Wed, 21 Jul 2010)
New Revision: 7248
Added:
pcbsd/current/ServiceManager/progress.cpp
pcbsd/current/ServiceManager/progress.h
pcbsd/current/ServiceManager/progress.ui
Modified:
pcbsd/current/ServiceManager/servicemanager.cpp
pcbsd/current/ServiceManager/servicemanager.h
pcbsd/current/ServiceManager/servicemanager.pro
pcbsd/current/ServiceManager/servicemanager.ui
Log:
Large update to "ServiceManager". Now instead of using its own "custom" services configuration,
it is just a pure front-end to /etc/rc.d/* and /usr/local/etc/rc.d/* scripts, and edits /etc/rc.conf accordingly.
Modified: pcbsd/current/ServiceManager/servicemanager.cpp
===================================================================
--- pcbsd/current/ServiceManager/servicemanager.cpp 2010-07-21 12:18:58 UTC (rev 7247)
+++ pcbsd/current/ServiceManager/servicemanager.cpp 2010-07-21 19:43:48 UTC (rev 7248)
@@ -13,24 +13,26 @@
#include "servicemanager.h"
#include <QTreeWidgetItem>
#include <qtextstream.h>
+#include <QDebug>
+#define S_DIRS "/etc/rc.d" << "/usr/local/etc/rc.d"
+
void ServiceManager::ProgramInit()
{
listServices->setColumnHidden(0, true);
+ listServices->setColumnHidden(1, true);
pushStart->setEnabled(FALSE);
pushStop->setEnabled(FALSE);
pushRestart->setEnabled(FALSE);
pushEnableStartup->setEnabled(FALSE);
pushDisableStartup->setEnabled(FALSE);
- pushConfigure->setEnabled(FALSE);
// Connect the buttons
connect( pushStart, SIGNAL( clicked() ), this, SLOT( startSlot() ) );
connect( pushStop, SIGNAL( clicked() ), this, SLOT( stopSlot() ) );
connect( pushRestart, SIGNAL( clicked() ), this, SLOT( restartSlot() ) );
- connect( pushConfigure, SIGNAL( clicked() ), this, SLOT( configureSlot() ) );
connect( pushEnableStartup, SIGNAL( clicked() ), this, SLOT( enableSlot() ) );
connect( pushDisableStartup, SIGNAL( clicked() ), this, SLOT( disableSlot() ) );
@@ -46,7 +48,6 @@
checkRunning();
// Start checking if services are enabled
- currentCheckEnabledItem = new QTreeWidgetItemIterator(listServices);
checkEnabled();
}
@@ -55,7 +56,6 @@
pushStart->setEnabled(enabled);
pushStop->setEnabled(enabled);
pushRestart->setEnabled(enabled);
- pushConfigure->setEnabled(enabled);
pushEnableStartup->setEnabled(enabled);
pushDisableStartup->setEnabled(enabled);
@@ -65,204 +65,268 @@
textTopLabel->setText(tr("Please Wait..."));
}
-void ServiceManager::configureSlot()
-{
- QTreeWidgetItem *item = listServices->currentItem();
- if (!item)
- return;
-
- workingTreeWidgetItem = item;
-
- // Start the detection script
- QString prog = "sh";
- QStringList args;
- args << "/PCBSD/Services/" + item->text(0) + "/configure.sh";
- ServiceConfig = new QProcess( this );
- //connect( ServiceConfig, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(checkServiceStartedSlot()) );
- ServiceConfig->start(prog, args);
-}
-
void ServiceManager::startSlot()
{
- QTreeWidgetItem *item = listServices->currentItem();
- if (!item)
+ QTreeWidgetItem *item = listServices->currentItem();
+ if (!item)
return;
- workingTreeWidgetItem = item;
+ workingTreeWidgetItem = item;
- // Disable the buttons until we are done
- setButtonsAllEnabled(false);
+ // Disable the buttons until we are done
+ setButtonsAllEnabled(false);
- // Start the detection script
- QString prog = "sh";
- QStringList args;
- args << "/PCBSD/Services/" + item->text(0) + "/start.sh";
- ServiceStart = new QProcess( this );
- connect( ServiceStart, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(checkServiceStartedSlot()) );
- ServiceStart->start(prog, args);
+ // Start the detection script
+ QString prog = item->text(0);
+ QStringList args;
+ args << "start";
+ // Show the progress GUI
+ progressUI *servAction = new progressUI;
+ servAction->startServ(prog, args);
+ servAction->show();
+
+ listSelectionChanged();
+
+ // Start checking the status of these services
+ currentCheckRunningItem = new QTreeWidgetItemIterator(listServices);
+ checkRunning();
+
}
void ServiceManager::stopSlot()
{
- QTreeWidgetItem *item = listServices->currentItem();
- if (!item)
+ QTreeWidgetItem *item = listServices->currentItem();
+ if (!item)
return;
- workingTreeWidgetItem = item;
+ workingTreeWidgetItem = item;
- // Disable the buttons until we are done
- setButtonsAllEnabled(false);
+ // Disable the buttons until we are done
+ setButtonsAllEnabled(false);
- // Start the detection script
- QString prog = "sh";
- QStringList args;
- args << "/PCBSD/Services/" + item->text(0) + "/stop.sh";
+ // Start the detection script
+ QString prog = item->text(0);
+ QStringList args;
+ args << "stop";
- ServiceStop = new QProcess( this );
- connect( ServiceStop, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(checkServiceStoppedSlot()) );
- ServiceStop->start(prog, args);
+ // Show the progress GUI
+ progressUI *servAction = new progressUI;
+ servAction->startServ(prog, args);
+ servAction->show();
+
+ listSelectionChanged();
+
+ // Start checking the status of these services
+ currentCheckRunningItem = new QTreeWidgetItemIterator(listServices);
+ checkRunning();
}
void ServiceManager::restartSlot()
{
- QTreeWidgetItem *item = listServices->currentItem();
- if (!item)
+ QTreeWidgetItem *item = listServices->currentItem();
+ if (!item)
return;
- workingTreeWidgetItem = item;
+ workingTreeWidgetItem = item;
- // Disable the buttons until we are done
- setButtonsAllEnabled(false);
+ // Disable the buttons until we are done
+ setButtonsAllEnabled(false);
- // Start the detection script
- QString prog = "sh";
- QStringList args;
- args << "/PCBSD/Services/" + item->text(0) + "/restart.sh";
+ // Start the detection script
+ QString prog = item->text(0);
+ QStringList args;
+ args << "restart";
- ServiceRestart = new QProcess( this );
- connect( ServiceRestart, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(checkServiceRestartedSlot()) );
- ServiceRestart->start(prog, args);
+ // Show the progress GUI
+ progressUI *servAction = new progressUI;
+ servAction->startServ(prog, args);
+ servAction->show();
+
+ listSelectionChanged();
+
+ // Start checking the status of these services
+ currentCheckRunningItem = new QTreeWidgetItemIterator(listServices);
+ checkRunning();
}
void ServiceManager::enableSlot()
{
- QTreeWidgetItem *item = listServices->currentItem();
- if (!item)
- return;
+ QTreeWidgetItem *item = listServices->currentItem();
+ if (!item)
+ return;
- workingTreeWidgetItem = item;
+ workingTreeWidgetItem = item;
+ QStringList rcList;
+ QString tag = item->text(1);
- // Disable the buttons until we are done
- setButtonsAllEnabled(false);
+ // Disable the buttons until we are done
+ setButtonsAllEnabled(false);
- // Start the detection script
- QString prog = "sh";
- QStringList args;
- args << "/PCBSD/Services/" + item->text(0) + "/enable.sh";
- ServiceEnable = new QProcess( this );
- connect( ServiceEnable, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(checkServiceEnabledSlot()) );
- ServiceEnable->start(prog, args);
+ // Read in the rc.conf
+ QFile file( "/etc/rc.conf" );
+ if ( file.open( QIODevice::ReadOnly ) ) {
+ QTextStream stream( &file );
+ stream.setCodec("UTF-8");
+ while ( !stream.atEnd() )
+ rcList << stream.readLine();
+ file.close();
+ } else {
+ return;
+ }
+
+ // Remove old tags if any
+ for ( int i=0; i<rcList.size(); i++ )
+ if ( rcList.at(i).indexOf(tag + "=") != -1 )
+ rcList.removeAt(i);
+
+ // Save the fixed rc.conf
+ if ( file.open( QIODevice::WriteOnly ) ) {
+ QTextStream stream( &file );
+ stream.setCodec("UTF-8");
+ for ( int i = 0; i<rcList.size(); i++ )
+ stream << rcList.at(i) << "\n";
+
+ stream << tag << "=\"YES\"\n";
+ file.close();
+ }
+
+ // Set the service as enabled
+ item->setText(4, tr("Enabled"));
+ listSelectionChanged();
}
void ServiceManager::disableSlot()
{
- QTreeWidgetItem *item = listServices->currentItem();
- if (!item)
- return;
+ QTreeWidgetItem *item = listServices->currentItem();
+ if (!item)
+ return;
- workingTreeWidgetItem = item;
+ workingTreeWidgetItem = item;
- // Disable the buttons until we are done
- setButtonsAllEnabled(false);
+ // Disable the buttons until we are done
+ setButtonsAllEnabled(false);
+ QStringList rcList;
+ QString tag = item->text(1);
- // Start the detection script
- QString prog = "sh";
- QStringList args;
- args << "/PCBSD/Services/" + item->text(0) + "/disable.sh";
+ // Disable the buttons until we are done
+ setButtonsAllEnabled(false);
- ServiceDisable= new QProcess( this );
- connect( ServiceDisable, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(checkServiceDisabledSlot()) );
- ServiceDisable->start(prog, args);
+ // Read in the rc.conf
+ QFile file( "/etc/rc.conf" );
+ if ( file.open( QIODevice::ReadOnly ) ) {
+ QTextStream stream( &file );
+ stream.setCodec("UTF-8");
+ while ( !stream.atEnd() )
+ rcList << stream.readLine();
+ file.close();
+ } else {
+ return;
+ }
+
+ // Remove old tags if any
+ for ( int i=0; i<rcList.size(); i++ )
+ if ( rcList.at(i).indexOf(tag + "=") != -1 )
+ rcList.removeAt(i);
+
+ // Save the fixed rc.conf
+ if ( file.open( QIODevice::WriteOnly ) ) {
+ QTextStream stream( &file );
+ stream.setCodec("UTF-8");
+ for ( int i = 0; i<rcList.size(); i++ )
+ stream << rcList.at(i) << "\n";
+
+ stream << tag << "=\"NO\"\n";
+ file.close();
+ }
+
+ // Set the service as enabled
+ item->setText(4, tr("Disabled"));
+ listSelectionChanged();
}
void ServiceManager::populateList()
{
- int found = 0;
+ QString tmp;
+ bool valid;
+ QString ServiceDir, ServiceTag, ServiceName;
- QDir d( "/PCBSD/Services");
+ QStringList sDirs;
+ sDirs << S_DIRS;
+
+ for ( int z = 0; z < sDirs.size(); ++z) {
+
+ QDir d( sDirs.at(z) );
- d.setFilter( QDir::Dirs );
- d.setSorting( QDir::Name );
+ d.setFilter( QDir::Files );
+ d.setSorting( QDir::Name );
- if ( d.count() == -1 )
- return;
+ if ( d.count() == 0 )
+ return;
- for ( int i = 0; i < d.count(); i++ )
- {
- QFile file( "/PCBSD/Services/" + d[i] + "/service.cfg" );
- if ( file.open( QIODevice::ReadOnly ) ) {
-
- ServiceDir[found]=d[i];
- disableStart[found] = 0;
- disableConfig[found] = 1;
- disableStop[found] = 0;
- disableRestart[found] = 0;
- disableStartup[found] = 0;
-
- QTextStream stream( &file );
- stream.setCodec("UTF-8");
- QString line;
- while ( !stream.atEnd() ) {
- line = stream.readLine(); // line of text excluding '\n'
-
+ for ( unsigned int i = 0; i < d.count(); i++ )
+ {
+ ServiceDir=""; ServiceTag=""; ServiceName="";
-
- if ( line.indexOf("name:") == 0)
- {
- ServiceName[found] = line.replace("name: ", "");
- }
-
- if ( line.indexOf("description:") == 0)
- {
- ServiceDescr[found] = line.replace("description: ", "");
- }
-
- if ( line.indexOf("disableStart: Y") == 0)
- {
- disableStart[found] = 1;
- }
- if ( line.indexOf("disableStop: Y") == 0)
- {
- disableStop[found] = 1;
- }
- if ( line.indexOf("disableRestart: Y") == 0)
- {
+ QFile file( sDirs.at(z) + "/" + d[i] );
+ if ( file.open( QIODevice::ReadOnly ) ) {
+ valid=false;
+ ServiceDir=d[i];
+ QTextStream stream( &file );
+ stream.setCodec("UTF-8");
+ QString line;
+ while ( !stream.atEnd() ) {
+ line = stream.readLine(); // line of text excluding '\n'
+
+ if ( line.indexOf("name=") == 0)
+ {
+ valid=true;
+ tmp = line.replace("name=", "");
+ ServiceName = tmp.replace('"', "");
+ }
+ if ( line.indexOf("rcvar=") == 0)
+ {
+ if ( tmp.isEmpty() )
+ continue;
- disableRestart[found] = 1;
- }
- if ( line.indexOf("disableStartup: YES") == 0)
- {
- disableStartup[found] = 1;
- }
-
- }
- file.close();
- QStringList cols;
- if (QFile::exists("/PCBSD/Services/" + ServiceDir[found] + "/configure.sh") )
- disableConfig[found] = 0;
- cols << ServiceDir[found] << ServiceName[found] << "Unknown" << "Unknown" << ServiceDescr[found];
- (void) new QTreeWidgetItem(listServices, cols );
- found++;
- }
- }
-
+ tmp = line.replace("rcvar=", "");
+ tmp = tmp.replace('"', "");
+ tmp = tmp.replace("'", "");
+ tmp = tmp.replace("`", "");
+ tmp = tmp.replace("$(set_rcvar)", "");
+ tmp = tmp.replace("$set_rcvar", "");
+ tmp = tmp.replace("set_rcvar", "");
+ tmp = tmp.replace("${name}", "");
+ tmp = tmp.replace("_enable", "");
+ tmp = tmp.replace(" ", "");
+ if (tmp.isEmpty())
+ ServiceTag = ServiceName + "_enable";
+ else
+ ServiceTag = tmp;
+
+ if ( ServiceTag.indexOf("_enable") == -1 )
+ ServiceTag=ServiceTag + "_enable";
+ }
+ }
+ file.close();
+
+ if ( !valid || ServiceTag.isEmpty() )
+ continue;
+
+ QStringList cols;
+ cols << sDirs.at(z) + "/" + ServiceDir << ServiceTag << ServiceName << tr("Unknown") << tr("Unknown");
+ (void) new QTreeWidgetItem(listServices, cols );
+ qDebug() << "Added Service:" << ServiceDir << ServiceName << ServiceTag;
+ }
+ }
+ }
+
}
@@ -272,9 +336,9 @@
if (*it)
{
// Start the detection script
- QString prog = "sh";
+ QString prog = (*it)->text(0);
QStringList args;
- args << "/PCBSD/Services/" + (*it)->text(0) + "/isRunning.sh";
+ args << "status";
CheckServiceRunning= new QProcess( this );
connect( CheckServiceRunning, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(checkRunningFinishedSlot()) );
@@ -287,18 +351,47 @@
void ServiceManager::checkEnabled()
{
+ QStringList rcList;
+ QStringList rcFiles;
+ QString tmp, tmp2;
+ rcFiles << "/etc/rc.conf" << "/etc/rc.conf.local" << "/etc/defaults/rc.conf";
+
+ // Read in the rc conf files
+ for ( int r = 0; r<rcFiles.size(); r++ ) {
+ QFile file( rcFiles.at(r) );
+ if ( file.open( QIODevice::ReadOnly ) ) {
+ QTextStream stream( &file );
+ stream.setCodec("UTF-8");
+ QString line;
+ while ( !stream.atEnd() )
+ rcList << stream.readLine();
+ file.close();
+ }
+ }
+
+
+
+ currentCheckEnabledItem = new QTreeWidgetItemIterator(listServices);
QTreeWidgetItemIterator it(*currentCheckEnabledItem);
- if (*it)
+ while(*it)
{
- // Start the detection script
- QString prog = "sh";
- QStringList args;
- args << "/PCBSD/Services/" + (*it)->text(0) + "/isEnabled.sh";
+ (*it)->setText(4, tr("Disabled") );
- CheckServiceEnabled= new QProcess( this );
- connect( CheckServiceEnabled, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(checkEnabledFinishedSlot()) );
- CheckServiceEnabled->start(prog, args);
+ for ( int i = 0; i< rcList.size(); i++) {
+ tmp = rcList.at(i).simplified();
+ tmp2 = (*it)->text(1) + "=\"YES\"";
+ if ( tmp.indexOf(tmp2) == 0 ) {
+ (*it)->setText(4, tr("Enabled") );
+ break;
+ }
+ tmp2 = (*it)->text(1) + "=\"NO\"";
+ if ( tmp.indexOf(tmp2) == 0 ) {
+ (*it)->setText(4, tr("Disabled") );
+ break;
+ }
+ }
+ it++;
}
}
@@ -306,37 +399,32 @@
void ServiceManager::checkRunningFinishedSlot()
{
QTreeWidgetItemIterator it(*currentCheckRunningItem);
-
+
if ( CheckServiceRunning->exitCode() == 0 && CheckServiceRunning->exitStatus() == QProcess::NormalExit)
{
- (*it)->setText(2, tr("Running") );
+ QString tmp = CheckServiceRunning->readAll();
+ if ( tmp.indexOf("is running") != -1 )
+ (*it)->setText(3, tr("Running") );
+ else if ( tmp.indexOf("not running") != -1 )
+ (*it)->setText(3, tr("Stopped") );
+ else
+ (*it)->setText(3, "" );
} else {
- (*it)->setText(2, tr("Stopped") );
+ (*it)->setText(3, "" );
}
(*currentCheckRunningItem)++;
+ // Update button status if we are on currently selected item
+ QTreeWidgetItem *i = listServices->currentItem();
+ if (i)
+ if(listServices->currentItem()->text(0) == (*it)->text(0) )
+ listSelectionChanged();
+
checkRunning();
}
-
-void ServiceManager::checkEnabledFinishedSlot()
-{
- QTreeWidgetItemIterator it(*currentCheckEnabledItem);
-
- if ( CheckServiceEnabled->exitCode() == 0 && CheckServiceEnabled->exitStatus() == QProcess::NormalExit)
- {
- (*it)->setText(3, tr("Startup Enabled") );
- } else {
- (*it)->setText(3, tr("Startup Disabled") );
- }
-
- (*currentCheckEnabledItem)++;
- checkEnabled();
-}
-
-
void ServiceManager::listSelectionChanged()
{
@@ -346,182 +434,35 @@
pushEnableStartup->setEnabled(FALSE);
pushDisableStartup->setEnabled(FALSE);
- QTreeWidgetItem *i = listServices->currentItem();
- if (!i)
- return;
+ QTreeWidgetItem *i = listServices->currentItem();
+ if (!i)
+ return;
+
+ if ( listServices->currentItem()->text(3) == tr("Running") )
+ {
+ pushStart->setEnabled(FALSE);
+ pushStop->setEnabled(TRUE);
+ pushRestart->setEnabled(TRUE);
+ }
+
+ if ( listServices->currentItem()->text(3) == tr("Stopped")
+ || (listServices->currentItem()->text(3).isEmpty()
+ && listServices->currentItem()->text(4) == tr("Enabled") ) )
+ {
+ pushStart->setEnabled(TRUE);
+ pushStop->setEnabled(FALSE);
+ pushRestart->setEnabled(FALSE);
+ }
- int j = 0;
-
- while (j < 500 )
- {
- if ( ServiceDir[j] == listServices->currentItem()->text(0) )
- {
- break;
- }
-
- j ++;
+ if ( listServices->currentItem()->text(4) == tr("Enabled") )
+ {
+ pushEnableStartup->setEnabled(FALSE);
+ pushDisableStartup->setEnabled(TRUE);
}
-
- if (j== 500 )
- {
- return;
- }
-
- int workingItem = j;
- if ( listServices->currentItem()->text(2) == tr("Running") )
- {
- pushStart->setEnabled(FALSE);
- pushStop->setEnabled(TRUE);
- pushRestart->setEnabled(TRUE);
- }
-
- if ( listServices->currentItem()->text(2) == tr("Stopped") )
- {
- pushStart->setEnabled(TRUE);
- pushStop->setEnabled(FALSE);
- pushRestart->setEnabled(FALSE);
- }
-
- if ( listServices->currentItem()->text(3) == tr("Startup Enabled") )
- {
- pushEnableStartup->setEnabled(FALSE);
- pushDisableStartup->setEnabled(TRUE);
- }
-
- if ( listServices->currentItem()->text(3) == tr("Startup Disabled") )
- {
- pushEnableStartup->setEnabled(TRUE);
- pushDisableStartup->setEnabled(FALSE);
- }
-
- if ( disableConfig[workingItem] == 1)
- {
- pushConfigure->setHidden(TRUE);
- pushConfigure->setEnabled(TRUE);
- } else {
- pushConfigure->setHidden(FALSE);
- }
-
- if ( disableStart[workingItem] == 1)
- {
- pushStart->setHidden(TRUE);
- } else {
- pushStart->setHidden(FALSE);
- }
-
- if ( disableStop[workingItem] == 1)
- {
- pushStop->setHidden(TRUE);
- } else {
- pushStop->setHidden(FALSE);
- }
-
- if ( disableRestart[workingItem] == 1)
- {
- pushRestart->setHidden(TRUE);
- } else {
- pushRestart->setHidden(FALSE);
- }
-
- if ( disableStartup[workingItem] == 1)
- {
- pushEnableStartup->setHidden(TRUE);
- pushDisableStartup->setHidden(TRUE);
- } else {
- pushEnableStartup->setHidden(FALSE);
- pushDisableStartup->setHidden(FALSE);
- }
-
+ if ( listServices->currentItem()->text(4) == tr("Disabled") )
+ {
+ pushEnableStartup->setEnabled(TRUE);
+ pushDisableStartup->setEnabled(FALSE);
+ }
}
-
-
-void ServiceManager::checkServiceStartedSlot()
-{
- // re-enable all the buttons
- setButtonsAllEnabled(true);
-
- if ( ServiceStart->exitCode() == 0 && ServiceStart->exitStatus() == QProcess::NormalExit)
- {
- workingTreeWidgetItem->setText(2, tr("Running") );
- } else {
- workingTreeWidgetItem->setText(2, tr("Stopped") );
- }
-
- textTopLabel->setText(tr("The following services are setup on this system. You may enable / disable them below."));
-
- listSelectionChanged();
-}
-
-
-void ServiceManager::checkServiceStoppedSlot()
-{
- // re-enable all the buttons
- setButtonsAllEnabled(true);
-
- if ( ServiceStop->exitCode() == 0 && ServiceStop->exitStatus() == QProcess::NormalExit)
- {
- workingTreeWidgetItem->setText(2, tr("Stopped") );
- } else {
- workingTreeWidgetItem->setText(2, tr("Running") );
- }
-
- textTopLabel->setText(tr("The following services are setup on this system. You may enable / disable them below."));
-
- listSelectionChanged();
-}
-
-
-void ServiceManager::checkServiceRestartedSlot()
-{
- // re-enable all the buttons
- setButtonsAllEnabled(true);
-
- if ( ServiceRestart->exitCode() == 0 && ServiceRestart->exitStatus() == QProcess::NormalExit)
- {
- workingTreeWidgetItem->setText(2, tr("Running") );
- } else {
- workingTreeWidgetItem->setText(2, tr("Stopped") );
- }
-
- textTopLabel->setText(tr("The following services are setup on this system. You may enable / disable them below."));
-
- listSelectionChanged();
-}
-
-
-void ServiceManager::checkServiceEnabledSlot()
-{
- // re-enable all the buttons
- setButtonsAllEnabled(true);
-
- if ( ServiceEnable->exitCode() == 0 && ServiceEnable->exitStatus() == QProcess::NormalExit)
- {
- workingTreeWidgetItem->setText(3, tr("Startup Enabled") );
- } else {
- workingTreeWidgetItem->setText(3, tr("Startup Disabled") );
- }
- textTopLabel->setText(tr("The following services are setup on this system. You may enable / disable them below."));
-
- listSelectionChanged();
-}
-
-
-void ServiceManager::checkServiceDisabledSlot()
-{
- // re-enable all the buttons
- setButtonsAllEnabled(true);
-
- if ( ServiceDisable->exitCode() == 0 && ServiceDisable->exitStatus() == QProcess::NormalExit)
- {
- workingTreeWidgetItem->setText(3, tr("Startup Disabled") );
- } else {
- workingTreeWidgetItem->setText(3, tr("Startup Enabled") );
- }
-
- textTopLabel->setText(tr("The following services are setup on this system. You may enable / disable them below."));
-
- listSelectionChanged();
-}
-
-
Modified: pcbsd/current/ServiceManager/servicemanager.h
===================================================================
--- pcbsd/current/ServiceManager/servicemanager.h 2010-07-21 12:18:58 UTC (rev 7247)
+++ pcbsd/current/ServiceManager/servicemanager.h 2010-07-21 19:43:48 UTC (rev 7248)
@@ -5,6 +5,8 @@
#include <qmessagebox.h>
#include <qdialog.h>
#include "ui_servicemanager.h"
+#include "ui_progress.h"
+#include "progress.h"
class ServiceManager : public QDialog, private Ui::ServiceManager
{
@@ -27,43 +29,22 @@
void enableSlot();
void disableSlot();
void checkRunningFinishedSlot();
- void checkEnabledFinishedSlot();
void listSelectionChanged();
- void checkServiceStartedSlot();
- void checkServiceStoppedSlot();
- void checkServiceRestartedSlot();
- void checkServiceEnabledSlot();
- void checkServiceDisabledSlot();
- void configureSlot();
-
private:
void setButtonsAllEnabled(bool enabled);
- QString ServiceDir[500];
- QString ServiceName[500];
- QString ServiceDescr[500];
- QProcess *ServiceStart;
- QProcess *ServiceStop;
QProcess *ServiceEnable;
QProcess *ServiceDisable;
- QProcess *ServiceRestart;
- QProcess *ServiceConfig;
QProcess *CheckServiceRunning;
QProcess *CheckServiceEnabled;
- int disableStop[500];
- int disableStart[500];
- int disableRestart[500];
- int disableStartup[500];
- int disableConfig[500];
void populateList();
void checkRunning();
void checkEnabled();
QTreeWidgetItem *workingTreeWidgetItem;
QTreeWidgetItemIterator *currentCheckRunningItem;
QTreeWidgetItemIterator *currentCheckEnabledItem;
+ progressUI *servAction;
-
-
signals:
} ;
Modified: pcbsd/current/ServiceManager/servicemanager.pro
===================================================================
--- pcbsd/current/ServiceManager/servicemanager.pro 2010-07-21 12:18:58 UTC (rev 7247)
+++ pcbsd/current/ServiceManager/servicemanager.pro 2010-07-21 19:43:48 UTC (rev 7248)
@@ -69,11 +69,11 @@
DESTDIR = /usr/local/bin/
-HEADERS += servicemanager.h
+HEADERS += servicemanager.h progress.h
-SOURCES += main.cpp servicemanager.cpp
+SOURCES += main.cpp servicemanager.cpp progress.cpp
-FORMS = servicemanager.ui
+FORMS = servicemanager.ui progress.ui
desktop.path=/usr/local/share/applications/
desktop.files=pcbsdservices.desktop
Modified: pcbsd/current/ServiceManager/servicemanager.ui
===================================================================
--- pcbsd/current/ServiceManager/servicemanager.ui 2010-07-21 12:18:58 UTC (rev 7247)
+++ pcbsd/current/ServiceManager/servicemanager.ui 2010-07-21 19:43:48 UTC (rev 7248)
@@ -18,7 +18,7 @@
<normaloff>:/images/player_play.png</normaloff>:/images/player_play.png</iconset>
</property>
<layout class="QGridLayout">
- <item row="0" column="0" colspan="8">
+ <item row="0" column="0" colspan="7">
<widget class="QLabel" name="textTopLabel">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
@@ -34,7 +34,7 @@
</property>
</widget>
</item>
- <item row="1" column="0" colspan="8">
+ <item row="1" column="0" colspan="7">
<widget class="QFrame" name="frame3">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@@ -66,6 +66,12 @@
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
+ <attribute name="headerDefaultSectionSize">
+ <number>150</number>
+ </attribute>
+ <attribute name="headerDefaultSectionSize">
+ <number>150</number>
+ </attribute>
<column>
<property name="text">
<string>SDIR</string>
@@ -73,22 +79,22 @@
</column>
<column>
<property name="text">
- <string>Service Name</string>
+ <string>TAG</string>
</property>
</column>
<column>
<property name="text">
- <string>Running</string>
+ <string>Service Name</string>
</property>
</column>
<column>
<property name="text">
- <string>AutoStart</string>
+ <string>Running</string>
</property>
</column>
<column>
<property name="text">
- <string>Description</string>
+ <string>Enabled</string>
</property>
</column>
</widget>
@@ -142,7 +148,7 @@
</property>
</widget>
</item>
- <item row="2" column="5">
+ <item row="2" column="4">
<widget class="QPushButton" name="pushEnableStartup">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -157,11 +163,11 @@
</size>
</property>
<property name="text">
- <string>Enable Startup</string>
+ <string>Enable Service</string>
</property>
</widget>
</item>
- <item row="2" column="7">
+ <item row="2" column="6">
<widget class="QPushButton" name="pushDisableStartup">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -176,7 +182,7 @@
</size>
</property>
<property name="text">
- <string>Disable Startup</string>
+ <string>Disable Service</string>
</property>
</widget>
</item>
@@ -193,17 +199,6 @@
</property>
</spacer>
</item>
- <item row="2" column="4">
- <widget class="QPushButton" name="pushConfigure">
- <property name="text">
- <string>&Configure</string>
- </property>
- <property name="icon">
- <iconset resource="servicemanager.qrc">
- <normaloff>:/images/configure.png</normaloff>:/images/configure.png</iconset>
- </property>
- </widget>
- </item>
<item row="2" column="1">
<widget class="QPushButton" name="pushStop">
<property name="sizePolicy">
More information about the Commits
mailing list