Example #1
0
void SearchLocationID::findNext( const QString& serverConfigFile )
{
	kdebugf();
	
	connect(&httpClient_, SIGNAL(finished()), this, SLOT(downloadingFinished()));
	connect(&httpClient_, SIGNAL(error()), this, SLOT(downloadingError()));
	connect(&httpClient_, SIGNAL(redirected(QString)), this, SLOT(downloadingRedirected(QString)));
	
	serverConfigFile_ = serverConfigFile;

	if (weatherConfig_ != 0)
		delete weatherConfig_;
	
	weatherConfig_ = new PlainConfigFile(WeatherGlobal::getConfigPath(serverConfigFile_));
		
	QString encoding = weatherConfig_->readEntry("Default","Encoding");
	decoder_ = QTextCodec::codecForName(encoding.ascii());
	
	host_ = weatherConfig_->readEntry("Name Search","Search host");
	httpClient_.setHost(host_);
	
	QString encodedCity = city_;
	encodeUrl(&encodedCity, encoding);
	url_.sprintf(weatherConfig_->readEntry("Name Search","Search path").ascii() , encodedCity.ascii());
	
	timerTimeout_->start(weather_global->CONNECTION_TIMEOUT, false);
	timeoutCount_ = weather_global->CONNECTION_COUNT;
	httpClient_.get(url_);
	
	kdebugf2();
}
void Q3GCache::statistics() const
{
#if defined(QT_DEBUG)
    QString line;
    line.fill(QLatin1Char('*'), 80);
    qDebug("%s", line.ascii());
    qDebug("CACHE STATISTICS:");
    qDebug("cache contains %d item%s, with a total cost of %d",
	   count(), count() != 1 ? "s" : "", tCost);
    qDebug("maximum cost is %d, cache is %d%% full.",
	   mCost, (200*tCost + mCost) / (mCost*2));
    qDebug("find() has been called %d time%s",
	   lruList->finds, lruList->finds != 1 ? "s" : "");
    qDebug("%d of these were hits, items found had a total cost of %d.",
	   lruList->hits,lruList->hitCosts);
    qDebug("%d item%s %s been inserted with a total cost of %d.",
	   lruList->inserts,lruList->inserts != 1 ? "s" : "",
	   lruList->inserts != 1 ? "have" : "has", lruList->insertCosts);
    qDebug("%d item%s %s too large or had too low priority to be inserted.",
	   lruList->insertMisses, lruList->insertMisses != 1 ? "s" : "",
	   lruList->insertMisses != 1 ? "were" : "was");
    qDebug("%d item%s %s been thrown away with a total cost of %d.",
	   lruList->dumps, lruList->dumps != 1 ? "s" : "",
	   lruList->dumps != 1 ? "have" : "has", lruList->dumpCosts);
    qDebug("Statistics from internal dictionary class:");
    dict->statistics();
    qDebug("%s", line.ascii());
#endif
}
void ElogConfigurationI::fillConfigurations() {
  QString strIPAddress;
  QString strName;
  QString strGroup;
  QString strEntry;
  KConfig cfg("kstrc", false, false);
  int     iPortNumber;
  int     i;
  
  for( i=0; i<10; i++ ) {
    strGroup.sprintf("ELOG%d", i );
    cfg.setGroup(strGroup);
    
    strIPAddress  = cfg.readEntry("IPAddress", "");
    iPortNumber   = cfg.readNumEntry("Port", 8080);
    strName       = cfg.readEntry("Name", "");
    
    strIPAddress.stripWhiteSpace();
    strName.stripWhiteSpace();
    
    if( !strIPAddress.isEmpty() ) {
      strEntry.sprintf( "%d [%s:%d:%s]", i, strIPAddress.ascii(), iPortNumber, strName.ascii() );
    } else {
      strEntry.sprintf( "%d", i );
    }
    comboBoxConfiguration->insertItem( strEntry );
  }
}
Example #4
0
File: tables.cpp Project: rd8/qGo
Talk::Talk(const QString &playername, QWidget * /* parent */, bool isplayer)
	: TalkGui()
{
	name = playername;

	// create a new tab
	QString s = "MultiLineEdit1_" + QString::number(++counter);
	MultiLineEdit1->setName(s.ascii()) ;
  
	MultiLineEdit1->setCurrentFont(setting->fontComments); 

	s = "LineEdit1_" + QString::number(++counter);
	LineEdit1->setName(s.ascii());
	LineEdit1->setFont(setting->fontComments);

	// do not add a button for shouts* or channels tab
	if ( (name.find('*') != -1) || (!isplayer))
	{

		delete pb_releaseTalkTab;
		delete pb_match;
		delete stats_layout;
	}
	
}
//=====================================
// XKeyboard::Layout/Model check
//-------------------------------------
void XKeyboard::validateLayout ( void ) {
	// log(L_INFO,"XKeyboard::validateLayout() called\n");
	// ...
	// this function check if the currently used combination
	// of layout and model is valid according to the Keyboard.map
	// if not we will provide a warning
	// ---
	QString XkbModel;
	QString XkbLayout;
	QDictIterator<char> itModel (mModelHash);
	for (; itModel.current(); ++itModel) {
	if (QString::fromLocal8Bit(itModel.current()) == mType->currentText()) {
		XkbModel = itModel.currentKey();
	}
	}
	// 2) primary XKB layout
	QDictIterator<char> itLayout (mLayoutHash);
	for (; itLayout.current(); ++itLayout) {
	if (QString::fromLocal8Bit(itLayout.current()) == mLayout->currentText()) {
		XkbLayout = itLayout.currentKey();
	}
	}
	QString isValid = qx ( VALIDATELAYOUT,STDOUT,2,"%s %s",
		XkbModel.ascii(),XkbLayout.ascii()
	);
	if (! isValid.toInt()) {
		setMessage ("noValidLayout");
	}
}
Example #6
0
bool First_scr::
extract_values( std::vector<double>& values, const QString& tagname,
                QDomElement& elem, int id ) {
  QDomNodeList node = elem.elementsByTagName( tagname );
  if( node.count() == 0 ) {
    GsTLcerr << "missing tag \"" << tagname.ascii() << "\" for variogram " 
             << id << gstlIO::end;
    return false;
  }
  QDomElement dir_elem = node.item(0).toElement();
  if( dir_elem.isNull() ) {
    GsTLcerr << "missing tag \"" << tagname.ascii() << "\" for variogram " 
             << id << gstlIO::end;
    return false;
  }

  QString dir_str = dir_elem.text();
  QStringList coords = QStringList::split( " ", dir_str, false );
  values.clear();
  for( int i=0 ; i < coords.size() ; i++ ) {
    values.push_back( coords[i].toDouble() );
  }

  return true;
}
//====================================
// getArrangement
//------------------------------------
QDict<QString> SCCMonitorArrange::getArrangement ( void ) {
	QDict<QString> result;
	QList<SCCLayoutLine> layout = mMatrix->getLayout();
	QListIterator<SCCLayoutLine> it (layout);
	for (; it.current(); ++it) {
		QString* key   = new QString();
		QString* value = new QString();
		SCCLayoutLine* l = it.current();
		int neighbour[4] = {l->mLeft,l->mRight,l->mTop,l->mBottom};
		key->sprintf("Screen:Screen[%d]",mCardID[l->ID]);
		for (int n=0;n<4;n++) {
		if (neighbour[n] == -1) {
			value->sprintf (
				"%s <none>",value->ascii()
			);
		} else {
			value->sprintf (
				"%s Screen[%d]",value->ascii(),neighbour[n]
			);
		}
		}
		*value = value->stripWhiteSpace();
		result.insert (
			*key,value
		);
	}
	return result;
}
Example #8
0
QString Unsettled::make_response ( const QString& chex, const QString& password ) const
{

	int size = chex.length ();
	if ( size & 1 )
		return "error";
	size >>= 1;

	// convert challenge from hex to bin
	QString cbin;
	for ( int i = 0; i < size; i++ )
	{
		QString tmp = chex.mid ( 2 * i, 2 );
		cbin.append ( ( char ) strtol ( tmp.ascii (), 0, 16 ) );
	}

	// calculate response
	unsigned char rbin[MD5_DIGEST_LENGTH];
	MD5state_st md5;
	MD5_Init ( &md5 );
	MD5_Update ( &md5, cbin.ascii (), size );
	MD5_Update ( &md5, password.toAscii(), password.length () );
	MD5_Final ( rbin, &md5 );

	// convert response from bin to hex
	QString rhex;
	for ( int i = 0; i < MD5_DIGEST_LENGTH; i++ )
	{
		char buffer[3];
		snprintf ( buffer, 3, "%02x", rbin[i] );
		rhex.append ( buffer );
	}

	return rhex;
}
Example #9
0
QString SysIBM::fieldValue(const QString &fieldName, const QString &path)
{
    int len = fieldName.length();

    QString val;

    if (len < 1) return val;

    val = dbgReadPathString(path);

    if (val.length() < 1) return val;

    QStringList lines = QStringList::split("\n", val);

    for ( QStringList::ConstIterator it = lines.begin(); it != lines.end(); ++it )
    {
        QString line = (*it);

        if ((int) line.length() > len + 1
                && line[len] == ':'
                && line.startsWith(fieldName))
        {
            printf("%s: Value for field '%s': '%s'\n",
                   path.ascii(), fieldName.ascii(),
                   line.mid(len+2).stripWhiteSpace().ascii());
            return line.mid(len+2).stripWhiteSpace();
        }
    }

    return QString();
}
Example #10
0
 void SlotTester::invokeMember(const QString &str)
 {
     QString slotname = QString::number(QSLOT_CODE) + str;
     connect(this, SIGNAL(invoke()), this, slotname.ascii());
     emit invoke();
     disconnect(this, SIGNAL(invoke()), this, slotname.ascii());
 }
Example #11
0
bool LoadCustomizationFile(QString srcPath)
{
    QString fn_Custom = QString("%1/%2.custom").arg(srcPath).arg(appName);
    DBG_OUT("Checking for Customization file: %s", fn_Custom.ascii() );

	if (QFile::exists(fn_Custom))
	{
        DBG_OUT("Customization file found. Loading custom parameters");
        ZConfig* cstm_File = new ZConfig(fn_Custom);

        if (cstm_File->groupExists("UNPACK_TOOLS"))
        {

            FullPath_7z = cstm_File->readEntry("UNPACK_TOOLS","BIN_FULLPATH",APP_FULLPATH_7Z);
            DBG_OUT("UNPACK_TOOLS::BIN_FULLPATH : '%s'", FullPath_7z.ascii() );
        }

        if (cstm_File->groupExists("MENU_CFGS"))
        {
            appMenuUUID = cstm_File->readEntry("MENU_CFGS","APP_MENU_UUID",APP_FULLPATH_7Z);
            DBG_OUT("MENU_CFGS::APP_MENU_UUID : '%s'", appMenuUUID.ascii() );
        }
        delete cstm_File;
        return true;
    }
	return false;
}
//=====================================
// XAccessX reset and switch to Intro
//-------------------------------------
void XAccessX::resetPage (int reload) {
	// ...
	// this function is called if the xaccess dialog is finished or canceled
	// AccessX is an X11 extension which need a seperate configuration file
	// which is outside of the normal configuration create via ISaX. Therefore
	// we don`t need to serialize any data here
	// ---
	if (reload == PAGE_RELOAD) {
	if (mEnable -> isChecked()) {
		QFile* mHandle = new QFile (
			"/usr/X11R6/lib/X11/xkb/X0-config.keyboard"
		);
		if (! mHandle -> open(IO_WriteOnly)) {
		log (L_ERROR,
			"XAccessX::open failed on: %s -> %s\n",
			mHandle->name().ascii(),strerror(errno)
		);
		}
		QString* speed = new QString();
		speed -> sprintf ( 
			"%d",mLCD -> intValue()
		);
		QDict<char> data;
		data.insert ("MouseKeysMaxSpeed=" , 
			speed->ascii()
		);
		data.insert ("MouseKeysDelay="    , "40");
		data.insert ("MouseKeysInterval=" , "10" );
		data.insert ("MouseKeysTimeToMax=", "1000" );
		data.insert ("MouseKeysCurve="    , "0"  );
		data.insert ("Controls+=","MouseKeysAccel");
		#if 0
		data.insert ("Controls+=",
			"MouseKeysAccel + AccessxKeys"
		);
		data.insert ("Feedback+=",
			"SlowKeysPress + SlowKeysAccept + StickyKeys + LatchToLock"
		);
		#endif
		QDictIterator<char> it (data);
		for (; it.current(); ++it) {
			QString line;
			line.sprintf ("%s %s\n",
				it.currentKey().ascii(),it.current()
			);
			mHandle -> writeBlock (
				line.ascii(),line.length()
			);
		}
		mHandle -> close();
	}
	}
	if (reload == PAGE_RELOAD) {
		slotApply();
	}
	mStatus -> clear();
	slotIntro (mIndex);
	XTemplate::resetPage ();
	mStack -> raiseWidget (Intro);
}
Example #13
0
QStringList CEmoticons::fileList(const char *theme)
{
  QString szdir = data->basedir + "/" + theme + "/";
  QString szaltdir = data->altbasedir + "/" + theme + "/";
  QStringList ret;
  QDir d(szdir);
  QDir altd(szaltdir);
  node_list_t list;
  node_list_t::iterator iter;
  struct node n;

  if (d.exists())
    loadTheme(data, szdir.ascii(), list);
  else if (altd.exists())
    loadTheme(data, szaltdir.ascii(), list);

  if (d.exists() || altd.exists())
  {
    for (iter  = list.begin();
         iter != list.end(); iter++)
    {
      n = *iter;
      ret << n.file;
    }
  }

  return ret;
}
Example #14
0
int main(int argc, char *argv[])
{
    KApplication::kdeinitExec("konsole");

    KApplication k(argc, argv, "klaunchertest");

    kapp->dcopClient()->registerAs(kapp->name());

#if 0
   QString error;
   QCString dcopService;
   int pid;
   int result = KApplication::startServiceByDesktopName(
		QString::fromLatin1("konsole"), QString::null, &error, &dcopService, &pid );

   printf("Result = %d, error = \"%s\", dcopService = \"%s\", pid = %d\n",
      result, error.ascii(), dcopService.data(), pid);

   result = KApplication::startServiceByDesktopName(
		QString::fromLatin1("konqueror"), QString::null,  &error, &dcopService, &pid );

   printf("Result = %d, error = \"%s\", dcopService = \"%s\", pid = %d\n",
      result, error.ascii(), dcopService.data(), pid);
#endif
}
Example #15
0
static void createSymlinks( const QString &location, const QString &package )
{

    QFile inFile( location + "/usr/lib/ipkg/info/" + package + ".list" );
    mkdir( "/usr/lib/ipkg", 0777 );
    mkdir( listDir, 0777 );

    QFile outFile( listDir + package + ".list");

//    odebug << "createSymlinks " << inFile.name().ascii() << " -> " << outFile.name().ascii() << "" << oendl;



    if ( inFile.open(IO_ReadOnly) && outFile.open(IO_WriteOnly)) {
        QTextStream in(&inFile);
        QTextStream out(&outFile);

        QString s;
        while ( !in.eof() ) {        // until end of file...
            s = in.readLine();       // line of text excluding '\n'
//      odebug << "Read: " << s.ascii() << "" << oendl;
            if (s.find(location,0,true) >= 0) {
//          odebug << "Found!" << oendl;
                s = s.replace(location,"");
            }
//      odebug << "Read after: " << s.ascii() << "" << oendl;

            // for s, do link/mkdir.
            if ( s.right(1) == "/" ) {
//      odebug << "do mkdir for " << s.ascii() << "" << oendl;
                mkdir( s.ascii(), 0777 );
                //possible optimization: symlink directories
                //that don't exist already. -- Risky.
            } else {
//      odebug << "do symlink for " << s.ascii() << "" << oendl;
                QFileInfo ffi( s );
                //Don't try to symlink if a regular file exists already
                if ( !ffi.exists() || ffi.isSymLink() ) {
                    if (symlink( (location+s).ascii(), s.ascii() ) != 0) {
                        if (errno == ENOENT) {
//          perror("Symlink Failed! ");
                            QString e=s.ascii();
                            e = e.replace(ffi.fileName(),"");
//          odebug << "DirName : " << e.ascii() << "" << oendl;
                            system ( QString("mkdir -p ")+e.ascii() );
                            if (symlink( (location+s).ascii(), s.ascii() ) != 0)
                                odebug << "Big problem creating symlink and directory" << oendl;
                        }
                    }
//          odebug << "Created << s.ascii() << oendl;
                    out << s << "\n";
                } else {
                    odebug << "" << s.ascii() << "  exists already, not symlinked" << oendl;
                }
            }
        }
        inFile.close();
        outFile.close();
    }
}
Example #16
0
//=====================================
// set cursor for root window...
//-------------------------------------
void setMouseCursor (const QString& cursorName) {
	QString optc ("-cursor_name");
	QString optd ("-display");
	QString display ( DisplayString ( QApplication::desktop()->x11Display() ));
	qx (XSETROOT,STDNONE,4,"%s %s %s %s",
		optc.ascii(),cursorName.ascii(),optd.ascii(),display.ascii()
	);
}
Example #17
0
QString SysIBM::dbgReadPathString(const QString &path)
{
    QString ret = readPathString(path);

    printf("READ '%s':\n%s(END)\n\n", path.ascii(), ret.ascii());

    return ret;
}
Example #18
0
bool SysIBM::dbgWritePathString(const QString &path, const QString &val)
{
    bool ret = writePathString(path, val);

    printf("WRITE [%d] '%s' <- '%s'\n\n", ret, path.ascii(), val.ascii());

    return ret;
}
Example #19
0
QString ZConfDlg::GetTodoPluginName(QString pluginPath) {
    printf("Entering GetTodoPluginName().\n");
    QString name("Shitting");
    QString bs("Fucking");

    void *libHandle;

    printf("Attempting to open %s.\n", pluginPath.ascii());
    libHandle = dlopen(pluginPath.ascii(), RTLD_LAZY);
    if (!libHandle) {
        printf("Err: failed in call to dlopen.\n");
        return bs;
    }

    dlclose(libHandle);
    
    printf("Exiting GetTodoPluginName().\n");
    return name;
    /*
    printf("Entering the GetTodoPluginName() function.\n");
    void *libHandle;
    create_todo_t pCreateFunc;
    destroy_todo_t pDestroyFunc;
    TodoPluginType *pTodoPlugin;
    QString name;
    printf("Created the functions variables.\n");

    // Open the plugin and load the creation and destroy symbols.
    libHandle = dlopen(pluginPath.ascii(), RTLD_LAZY);
    if (!libHandle) {
        return QString("Failed to open .so file.");
    }

    pCreateFunc = (create_todo_t)dlsym(libHandle, "createTodoPlugin");
    if (!pCreateFunc) {
        return QString("Failed to get create symbol.");
    }

    pDestroyFunc = (destroy_todo_t)dlsym(libHandle, "destroyTodoPlugin");
    if (!pDestroyFunc) {
        return QString("Failed to get destroy symbol.");
    }

    pTodoPlugin = pCreateFunc();
    if (!pTodoPlugin) {
        return QString("Failed to create object.");
    }

    // At this point it should be opened.
    name = QString(pTodoPlugin->GetPluginName());

    pDestroyFunc(pTodoPlugin);
    dlclose(libHandle);

    printf("Exiting the GetTodoPluginName() function.\n");
    return name;
    */
}
Example #20
0
int main(int argc, char** argv)
{
    QString fPath = QString(argv[0]);
    appName = fPath.mid( fPath.findRev("/") +1 );
    appPath = fPath.left( fPath.findRev("/") );

    DBG_OUT("App Name : %s", appName.ascii() );
    DBG_OUT("App Path : %s", appPath.ascii() );

    checkDirectories();
    APPDB_Open();

	ZApplication* app = new ZApplication(argc, argv);

    FullPath_7z = APP_FULLPATH_7Z;

    if ( !detectLanguageFile(appPath) )
    {
        detectLanguageFile( APP_SYSFILES_PATH );
    }

    if ( !LoadCustomizationFile(appPath) )
    {
        LoadCustomizationFile( APP_SYSFILES_PATH );
    }

    srand( (int)getpid() );

    if (argc>1)
    {
        if ( checkParameters(argc,argv) )
        {
            delete app;
            return 0;
        }
    }

    // LoadAllRegisteredApp();

    DBG_OUT("Register Load DONE");

	zBaseGUI *gui = new zBaseGUI(NULL);
//    DBG_OUT("GUI Done (gui = %Xl , app = %Xl )", (uint)gui, (uint)app);
	app->setMainWidget(gui);
//	DBG_OUT("Set Main");
        gui->show();

	int ret=app->exec();
//int ret=0;
	delete gui;
	delete app;

    APPDB_Close();
	return ret;
}
void VolumeGridRoverMainWindow::fileOpen()
{
  QString filename = QFileDialog::getOpenFileName(QString::null,
					   "Volume Files (*.rawiv *.rawv *.cvc *.mrc)",
					   this,
					   "open file dialog",
					   "Choose a volume file" );
  if(filename == QString::null) return;
  
  functionChangedSlot(); /* set the current transfer function so the slice appears correct */
 
#if 0 
  if(filename.endsWith(".rawiv",false))
    {
      m_MappedVolumeFile = new MappedRawIVFile(filename.ascii(),true,true);
      if(!m_MappedVolumeFile->isValid())
	cvcapp.log(5, boost::str(boost::format("VolumeFile::VolumeFile(): Could not load '%s'")%filename.ascii()));
    }
  else if(filename.endsWith(".rawv",false))
    {
      m_MappedVolumeFile = new MappedRawVFile(filename.ascii(),true,true);
      if(!m_MappedVolumeFile->isValid())
	cvcapp.log(5, boost::str(boost::format("VolumeFile::VolumeFile(): Could not load '%s'")%filename.ascii()));
    }
  else /* try to figure out the volume type */
    {
      m_MappedVolumeFile = new MappedRawIVFile(filename.ascii(),true,false);
      if(m_MappedVolumeFile->isValid()) return;
      delete m_MappedVolumeFile;

      m_MappedVolumeFile = new MappedRawVFile(filename.ascii(),true,false);
      if(m_MappedVolumeFile->isValid()) return;
      delete m_MappedVolumeFile;

      m_MappedVolumeFile = NULL;
      cvcapp.log(5, "VolumeFile::VolumeFile(): m_MappedVolumeFile == NULL");
    }

  
  if(m_VolumeGridRover->setVolume(m_MappedVolumeFile))
    {
      functionChangedSlot();
      setCaption(filename + " - Volume Grid Rover");
    }
  else
    setCaption("Volume Grid Rover");
#endif

  VolMagick::VolumeFileInfo vfi(filename.ascii());
  m_VolumeFileInfo = vfi;
  m_VolumeGridRover->setVolume(vfi);
  setCaption(filename + " - Volume Grid Rover");
}
Example #22
0
//
// addButton - add a button
//
// Creates a new button given all the paramerters for it
// (this is for a public slot)
//
void
MsgDialog::addButton(const QString &name, const QString &filter,
		     const QColor &color, bool bAct)
{
#ifdef DEBUGMSG
  qDebug("addButton() '%s', '%s', '%s' %s", name.ascii(), filter.ascii(),
       color.name().ascii(), bAct?"Active":"InActive");
#endif

  newButton(name, filter, color, bAct);

} // end addButton()         
Example #23
0
bool GraphModeler::getSaveFilename(std::string &filename)
{
    QString s = sofa::gui::qt::getSaveFileName ( this, NULL, "Scenes (*.scn *.xml)", "save file dialog", "Choose where the scene will be saved" );
    if ( s.length() >0 )
    {
        std::string extension=sofa::helper::system::SetDirectory::GetExtension(s.ascii());
        if (extension.empty()) s+=QString(".scn");
        filename = s.ascii();
        return true;
    }
    return false;
}
Example #24
0
/* Create a child MetaSGS or SWS to associate with a simulation
 */
QString Gridifier::makeSteeringService(const QString &factory,
				       const LauncherConfig &config,
				       const QString &parentEPR){
  struct soap mySoap;
  struct sws__AddChildRequest request;
  struct sws__AddChildResponse response;
  struct wsrp__SetResourcePropertiesResponse setRPresponse;
  char   tmpBuf1[256];
  char   tmpBuf2[256];
  QString callBuf;
  QString result;
  QString epr = this->makeSteeringService(factory, config);

  if(epr.isEmpty()) return epr;

  // Tell the child service about its parent
  callBuf = "<parentEPR>" + parentEPR + "</parentEPR>";
  soap_init(&mySoap);

  cout << "makeSteeringService: Calling SetResourceProperties with >>" <<
    callBuf << "<<" << endl;

  if(soap_call_wsrp__SetResourceProperties(&mySoap, epr, "", 
					   (char*)callBuf.ascii(),
					   &setRPresponse) != SOAP_OK){
    cout << "makeSteeringService: SetResourceProperties failed:" << endl;
    soap_print_fault(&mySoap, stderr);
    soap_end(&mySoap);
    soap_done(&mySoap);
    return result;
  }

  // Now tell the parent about this child
  snprintf(tmpBuf1, 256, "%s", epr.ascii());
  snprintf(tmpBuf2, 256, "%s", 
	   config.mJobData->mSoftwareDescription.ascii());
  request.epr = tmpBuf1;
  request.name = tmpBuf2;

  if( soap_call_sws__AddChild(&mySoap, parentEPR, "", 
			      request, &response) != SOAP_OK ){
    cout << "makeSteeringService: AddChild failed:" << endl;
    soap_print_fault(&mySoap, stderr);
  }
  else {
    result = epr;
  }

  soap_end(&mySoap);
  soap_done(&mySoap);
  return result;
}
Example #25
0
//=====================================
// XQuery run query...
//-------------------------------------
QString* XQuery::run (void) {
	QString optd ("-d");
	QString dpy  (DisplayString (x11Display()));
	if (mArg.isEmpty()) {
		if (! errorCheck) {
		*mResult = qx ( XQUERY,STDOUT,3,"%s %s %s",
			optd.ascii(),dpy.ascii(),mOpt.ascii()
		);
		} else {
		*mResult = qx ( XQUERY,STDERR,3,"%s %s %s",
			optd.ascii(),dpy.ascii(),mOpt.ascii()
		);
		}
	} else {
		if (! errorCheck) {
		*mResult = qx ( XQUERY,STDOUT,4,"%s %s %s %s",
			optd.ascii(),dpy.ascii(),mOpt.ascii(),mArg.ascii()
		);
		} else {
		*mResult = qx ( XQUERY,STDERR,4,"%s %s %s %s",
			optd.ascii(),dpy.ascii(),mOpt.ascii(),mArg.ascii()
		);
		}
	}
	return (mResult);
}
void ElogThread::addAttachment( QDataStream& stream,
                                const QString& boundary,
                                const QByteArray& byteArray,
                                int iFileNumber,
                                const QString& name ) {
  if (byteArray.count() > 0) {
    QString strStart = QString("Content-Disposition: form-data; name=\"attfile%1\"; filename=\"%2\"\r\n\r\n").arg(iFileNumber).arg(name);
    QString strEnd   = QString("%1\r\n").arg(boundary);

    stream.writeRawBytes(strStart.ascii(), strStart.length());
    stream.writeRawBytes(byteArray.data(), byteArray.count());
    stream.writeRawBytes(strEnd.ascii(), strEnd.length());
  }
}
Example #27
0
int main (void) {
	SaXException().setDebug (true);
	QDict<SaXImport> section;
	int importID[] = {
		SAX_POINTERS,
		SAX_LAYOUT
	};
	printf ("Importing data...\n");
	SaXConfig* config = new SaXConfig;
	for (int id=0; id<2; id++) {
		SaXImport* import = new SaXImport ( importID[id] );
		import -> setSource ( SAX_SYSTEM_CONFIG );
		import -> doImport();
		config -> addImport (import);
		section.insert (
			import->getSectionName(),import
		);
	}
	printf ("Adding new pointer device... ");
	SaXManipulateDevices dev (
		section["Pointers"],section["Layout"]
	);
	int tabletID = dev.addInputDevice (SAX_INPUT_TABLET);
	printf ("ID: %d is [SAX_INPUT_TABLET]: added\n",tabletID);

	printf ("Setting up tablet data... ");
	SaXManipulateTablets pointer (
		section["Pointers"],section["Layout"]
	);
	if (pointer.selectPointer (tabletID)) {
		QList<QString> tabletList = pointer.getTabletList();
		QList<QString> penList = pointer.getPenList();
		QString* myTablet = tabletList.at (3);
		QString* myPen = penList.at(3);
		pointer.setTablet( *myTablet );
		pointer.addPen ( *myPen );
		printf ("Tablet: [%s] with pen: [%s] configured\n",
			myTablet->ascii(),myPen->ascii()
		);
	}
	printf ("writing configuration\n");
	config -> setMode (SAX_MERGE);
	if ( ! config -> createConfiguration() ) {
		printf ("%s\n",config->errorString().ascii());
		printf ("%s\n",config->getParseErrorValue().ascii());
		return 1;
	}
	return (0);
}
Example #28
0
void MythPianoService::BroadcastMessage(const char *format, ...)
{
	QString buffer;
	va_list args;
	va_start(args, format);
	buffer.vsprintf(format, args);
	va_end(args);

	if(debug)
		printf("**** MythPianoService: %s\n", buffer.ascii());

	if (m_Listener)
		m_Listener->RecvMessage(buffer.ascii());
	
}
Example #29
0
int Transmitter::call(QString host, int port, int prot)
{
	init(prot);

	int sd = -1;
	
	sa.sin_port = htons(port);
	
	if (inet_aton(host.ascii(), &sa.sin_addr) == 0)
	{
		struct hostent *he;

		he = gethostbyname(host.ascii());
		if (he == NULL)
			throw Error(tr("can't resolve ") + host.ascii());
		sa.sin_addr = *(struct in_addr *) he ->h_addr;
	}
	
	int type = 0;
	
	switch(protocol)
	{
		case DRTA_UDP:
			type = SOCK_DGRAM;
			break;
		case DRTA_TCP:
		case DRTA_SCTP:
			type = SOCK_STREAM;
			break;
		case DRTA_SCTP_UDP:
			type = SOCK_SEQPACKET;
			break;
		default:
			throw Error("unknown protocol");
	}
	
	if ((sd = socket(AF_INET, type, 0)) == -1)
		throw Error(tr("can't initalize socket (") + strerror(errno)+ tr(")"));
	
	if ((::connect(sd, (struct sockaddr *)&sa, sizeof(sa)))==-1)
		throw Error(strerror(errno));
	
	start(sd);
	
	initRecorder();
	
	return sd;
}
    KJS::Value JSObjectProxy::get( KJS::ExecState *exec, const KJS::Identifier &p ) const {
            if ( !isAllowed( exec->interpreter() ) ) {
                kdWarning() << "JS get request from unknown interpreter, ignoring" << endl;
                return KJS::Null();
            }

            if ( !policy->isPropertyAllowed( this, obj, p.ascii() ) )
                return ObjectImp::get( exec, p );

            if ( !obj ) {
                kdDebug( 80001 ) << "JS getting '" << p.ustring().qstring() << "' but qobj has died" << endl;
                return ObjectImp::get( exec, p );
            }
            kdDebug( 80001 ) << "JS getting '" << p.ascii() << endl;

            // Properties
            QString prop = p.ustring().qstring();
            QMetaObject *meta = obj->metaObject();

            if ( meta->findProperty( p.ascii(), true ) != -1 ) {
                QVariant val = obj->property( prop.ascii() );
                kdDebug( 80001 ) << "JS getting '" << p.ascii() << "' ( " << val.typeName() << ")" << endl;

                return convertToValue( exec, val );
            }

            return ObjectImp::get
                       ( exec, p );
        }