Beispiel #1
0
/** Creates a new CheckOperation.
    @param d the Device where the Partition to check is on.
    @param p the Partition to check
*/
CheckOperation::CheckOperation(Device& d, Partition& p) :
    Operation(),
    m_TargetDevice(d),
    m_CheckedPartition(p),
    m_CheckJob(new CheckFileSystemJob(checkedPartition())),
    m_MaximizeJob(new ResizeFileSystemJob(targetDevice(), checkedPartition()))
{
    addJob(checkJob());
    addJob(maximizeJob());
}
Beispiel #2
0
bool KMThreadJob::removeJob(int ID)
{
	if (!checkJob(ID) || kill((pid_t)ID, SIGTERM) == 0)
	{
		m_jobs.remove(ID);
		saveJobs();
		return true;
	}
	else
		return false;
}
wUserPanel::wUserPanel(user *usr, QWidget *parent) :
    QWidget(parent),
    ui(new Ui::wUserPanel)
{
    ui->setupUi(this);
    t_user = usr;
    setWindowTitle(QString("Panel de Opciones::Usuario %1 (%2, %3)").arg(t_user->username()).arg(t_user->lastname()).arg(t_user->name()));
    connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(close()));
    connect(ui->logoutButton, SIGNAL(clicked()), this, SLOT(logout()));

    connect(ui->searchJobButton, SIGNAL(clicked()), this, SLOT(searchJob()));
    connect(ui->viewJobButton, SIGNAL(clicked()), this, SLOT(checkJob()));
    connect(ui->newJobButton, SIGNAL(clicked()), this, SLOT(addJob()));
    connect(ui->configButton, SIGNAL(clicked()), this, SLOT(options()));

    if(!t_user->isAdmin()){
        ui->adminGroupBox->setEnabled(false);
        ui->adminGroupBox->setVisible(false);
    };
    connect(ui->usersButton, SIGNAL(clicked()), this, SLOT(manageUsers()));
}
bool CDropManager::doDropRandom(CPC* _pPC, CNPC* _pNPC , CDropInfo* _pDrop, bool _bPreferenceIndex)
{
	if( _pDrop->getItemCount() == 0 )
		return false;

	int i=0;

	int itemCount = _pDrop->getItemCount();
	for(i=0; i<itemCount; i++ )
	{
		if( !checkJob(_pDrop->getItemData(i)->getJobFlag(), _pPC->m_job ) )
			continue;

		if( !checkProbPerLevel(_pDrop->getItemData(i)->getProb(), _pPC->m_level-_pNPC->m_level, _pDrop->getProbPerLevel()) )
			continue;

		if( !dropItem(_pPC, _pNPC, _pDrop->getItemData(i), _bPreferenceIndex) )
			continue;
	}

	return true;
}
Beispiel #5
0
/** Creates a new NewOperation.
    @param d the Device to create a new Partition on
    @param p pointer to the new Partition to create. May not be nullptr.
*/
NewOperation::NewOperation(Device& d, Partition* p) :
    Operation(),
    m_TargetDevice(d),
    m_NewPartition(p),
    m_CreatePartitionJob(new CreatePartitionJob(targetDevice(), newPartition())),
    m_CreateFileSystemJob(nullptr),
    m_SetPartFlagsJob(nullptr),
    m_SetFileSystemLabelJob(nullptr),
    m_CheckFileSystemJob(nullptr)
{
    addJob(createPartitionJob());

    const FileSystem& fs = newPartition().fileSystem();

    if (fs.type() != FileSystem::Extended) {
        // It would seem tempting to skip the CreateFileSystemJob or the
        // SetFileSystemLabelJob if either has nothing to do (unformatted FS or
        // empty label). However, the user might later on decide to change FS or
        // label. The operation stack will merge these operations with this one here
        // and if the jobs don't exist things will break.

        m_CreateFileSystemJob = new CreateFileSystemJob(targetDevice(), newPartition());
        addJob(createFileSystemJob());

        if (fs.type() == FileSystem::Lvm2_PV) {
            m_SetPartFlagsJob = new SetPartFlagsJob(targetDevice(), newPartition(), PartitionTable::FlagLvm);
            addJob(setPartFlagsJob());
        }

        m_SetFileSystemLabelJob = new SetFileSystemLabelJob(newPartition(), fs.label());
        addJob(setLabelJob());

        m_CheckFileSystemJob = new CheckFileSystemJob(newPartition());
        addJob(checkJob());
    }
}
Beispiel #6
0
bool KMThreadJob::loadJobs()
{
	TQFile	f(jobFile());
	if (f.exists() && f.open(IO_ReadOnly))
	{
		TQTextStream	t(&f);
		TQString		line;

		m_jobs.clear();
		while (!t.eof())
		{
			line = t.readLine().stripWhiteSpace();
			if (line.isEmpty())
				continue;
			TQStringList	ll = TQStringList::split(CHARSEP,line,true);
			if (ll.count() == 5)
			{
				KMJob	*job = new KMJob();
				job->setId(ll[0].toInt());
				job->setName(ll[1]);
				job->setPrinter(ll[2]);
				job->setOwner(ll[3]);
				job->setSize(ll[4].toInt());
				job->setState(KMJob::Printing);
				job->setType(KMJob::Threaded);
				job->setUri("proc:/"+ll[0]);
				if (job->id() > 0 && checkJob(job->id()))
					m_jobs.insert(job->id(),job);
				else
					delete job;
			}
		}
		return true;
	}
	return false;
}