Source Code (Use browser search to find items of interest.)

Class Index

klpq'Spooler (./kdeutils/klpq/klpqspooler.h:33)

class Spooler
{
public:
  Spooler () {}
  virtual ~Spooler () {}

  virtual void    updateCommand ( KProcess *proc, QString queue );
  virtual void    setQueuingCommand ( KProcess *proc, QString queue, bool b );
  virtual QString removeCommand ( QString queue, QString id );
  virtual void    makeTopCommand ( KProcess *proc, QString queue, QString id );
  virtual void    setPrintingCommand ( KProcess *proc, QString queue, bool b);
  virtual void    statusCommand ( KProcess *proc, QString queue );

  virtual void parseUpdate ( QListView *list, QListBox *status, QString lpq_in_buffer );

  /*
  void parseRemove ( ) {}
  void parseMakeTop ( ) {}
  */

  virtual int  parsePrinting ( char *buffer, int len );
  virtual int  parseQueuing ( char *buffer, int len );
  virtual void parseStatus ( char *buffer, int len, QCheckBox *c_queuing, QCheckBox *c_printing );

protected:
  QString lpq_path;
  QString lpc_path;
  QString lprm_path;
};


klpq'Spooler::setPrintingCommand() (./kdeutils/klpq/klpqspooler.cpp:38)

void Spooler::setPrintingCommand( KProcess *proc, QString queue, bool b )
{
  if( b )
    *proc << lpc_path << "start" << queue;
  else
    *proc << lpc_path << "stop" << queue;
}


klpq'Spooler::statusCommand() (./kdeutils/klpq/klpqspooler.cpp:46)

void Spooler::statusCommand( KProcess *proc, QString queue )
{
  *proc << lpc_path << "status" << queue;
}


klpq'Spooler::updateCommand() (./kdeutils/klpq/klpqspooler.cpp:51)

void Spooler::updateCommand( KProcess *proc, QString queue )
{
  *proc << lpq_path << "-P" << queue;
}


klpq'Spooler::setQueuingCommand() (./kdeutils/klpq/klpqspooler.cpp:56)

void Spooler::setQueuingCommand( KProcess *proc, QString queue, bool b )
{
  if( b )
    *proc << lpc_path << "enable" << queue;
  else
    *proc << lpc_path << "disable" << queue;
}


klpq'Spooler::removeCommand() (./kdeutils/klpq/klpqspooler.cpp:64)

QString Spooler::removeCommand( QString queue, QString id )
{
  QString temp;
  temp = lprm_path + " -P " + queue + " " + id;
  return temp;
}


klpq'Spooler::makeTopCommand() (./kdeutils/klpq/klpqspooler.cpp:71)

void Spooler::makeTopCommand( KProcess *proc, QString queue, QString id )
{
  *proc << lpc_path << "topq" << queue << id;
}


klpq'Spooler::parseUpdate() (./kdeutils/klpq/klpqspooler.cpp:76)

void Spooler::parseUpdate( QListView *lb_list, 
			   QListBox *lb_status, QString lpq_in_buffer )
{
  QString temp;
  unsigned int i = 0, j = 0;
  unsigned char c;
  for( j = 0; j < lpq_in_buffer.length(); j++ )
    {
      c = lpq_in_buffer.data()[j];
      if ( c != '\n' )
	temp += c;
      else
	{
	  if(temp.contains("Rank"))
	     { i = 1; temp = ""; continue; }
          if( temp.length() == 0 )
            { temp = ""; continue; }
	  if(i == 0) 
	    {
	      lb_status->insertItem(temp);
	    }
	  else
	    {
	      qDebug("appending the following: %s",temp.latin1());
	      QStringList sl = QStringList::split(QRegExp("\\s"), temp);
	      MyLVI *lvi = new MyLVI(lb_list, sl[0], sl[1], 
				     sl[2].toInt(), sl[3], sl[4]);
	      lb_list->insertItem(lvi);
	    }
	  temp = "";
	}
    }
}


klpq'Spooler::parsePrinting() (./kdeutils/klpq/klpqspooler.cpp:110)

int Spooler::parsePrinting( char *buffer, int len )
{
  unsigned char c;
  int j = 0;
  QString temp;
  while( (c = *(buffer+j)) && j < len )
    {
      j++;
      if ( c >= 128) break;
      if ( c != '\n' )
	temp += c;
      else
	{
	  if(temp.contains("Privileged"))
	    return -1;
	  temp = "";
	  }
    }
  return 0;
}


klpq'Spooler::parseQueuing() (./kdeutils/klpq/klpqspooler.cpp:131)

int Spooler::parseQueuing( char *buffer, int len )
{
  unsigned char c;
  int j = 0;
  QString temp;
  while( (c = *(buffer+j)) && j < len )
    {
      j++;
      if ( c >= 128) break;
      if ( c != '\n' )
	temp += c;
      else
	{
	  if(temp.contains("Privileged"))
	    return -1;
	  temp = "";
	}
    }
  return 0;
}


klpq'Spooler::parseStatus() (./kdeutils/klpq/klpqspooler.cpp:152)

void Spooler::parseStatus( char *buffer, int len, QCheckBox *c_queuing, QCheckBox *c_printing )
{
  unsigned char c;
  int j = 0;
  QString temp;
  while( (c = *(buffer+j)) && j < len )
    {
      j++;
      if ( c >= 128) break;
      if ( c != '\n' )
	temp += c;
      else
	{
	  if(temp.contains("queuing"))
	    { 
	      if(temp.contains("disabled"))
		{ c_queuing->setChecked(FALSE); }
	      else
		{ c_queuing->setChecked(TRUE); }
	      temp = ""; continue; 
	    }
	  else if (temp.contains("printing"))
	    { 
	      if(temp.contains("disabled"))
		{ c_printing->setChecked(FALSE); }
		else
		  { c_printing->setChecked(TRUE); }
	      temp = ""; continue; 
	    }
	  temp = "";
	}
    }
}

// ------------------------------------------