Example #1
0
void Config::saveAllShortcut()
{
    QXmlPut xmlPut(RootKey);

    QMap<QString, QString> shortcuts = ActionManager::getAllShortcut();
    QMap<QString, QString>::const_iterator it = shortcuts.constBegin();
    while (it != shortcuts.constEnd()) {
        xmlPut.descend(ShortcutKey);
        xmlPut.putString(KeySequenceKey, it.key());
        xmlPut.putString(ActionKey, it.value());
        xmlPut.rise();
        ++it;
    }

    xmlPut.save(ShortcutFilePath());
}
Example #2
0
int main (int argc, char **argv)
{
   DnxXmlBuf xbuf;
   DnxJob job;
   char *cp;
   int ret;

   // Set program base name
   szProg = (char *)((cp = strrchr(argv[0], '/')) ? (cp+1) : argv[0]);

   // Initialize Job structure
   memset(&job, 0, sizeof(job));
   dnxMakeXID(&job.xid, DNX_OBJ_JOB, 12345L, 3);
   job.state    = DNX_JOB_PENDING;
   job.priority = 7;
   job.cmd      = "check_spam.pl <wak>test</wak> ahora por favor";
   jobDump("Initialized Job", &job);

   // Create an XML buffer
   if ((ret = xmlPut(&xbuf, &job)) == DNX_OK)
   {
      // Examine the XML buffer
      xmlDump("After xmlPut", &xbuf);

      // Clear the job structure and see if we get the same data back from the XML buffer
      printf("Clearing the job structure.\n");
      memset(&job, 0, sizeof(job));
      jobDump("Cleared Job", &job);

      // Reconstitute the job structure from the xml buffer
      ret = xmlGet(&xbuf, &job);

      // Examine the XML buffer
      jobDump("After xmlGet", &job);

      // Cleanup
      if (job.cmd) free(job.cmd);
   }
   else
      fprintf(stderr, "Error from xmlPut: %d\n", ret);

   return ret;
}
Example #3
0
//------------------------------------------------------------------------------
void CPrivateXmlData::saveXml(const QString& strFileName)
{
	QXmlPut xmlPut(getTagName());
	write(&xmlPut);
	xmlPut.save(strFileName);
}
Example #4
0
//------------------------------------------------------------------------------
QString CPrivateXmlData::toXmlString()
{
	QXmlPut xmlPut(getTagName());
	write(&xmlPut);
	return xmlPut.toString();
}