void Qhp::initialize() { /* <QtHelpProject version="1.0"> <namespace>mycompany.com.myapplication.1_0</namespace> <virtualFolder>doc</virtualFolder> <customFilter name="My Application 1.0"> <filterAttribute>myapp</filterAttribute> <filterAttribute>1.0</filterAttribute> </customFilter> <filterSection> <filterAttribute>myapp</filterAttribute> <filterAttribute>1.0</filterAttribute> .. */ QCString nameSpace = Config_getString(QHP_NAMESPACE); QCString virtualFolder = Config_getString(QHP_VIRTUAL_FOLDER); m_doc.declaration("1.0", "UTF-8"); const char * rootAttributes[] = { "version", "1.0", 0 }; m_doc.open("QtHelpProject", rootAttributes); m_doc.openCloseContent("namespace", nameSpace); m_doc.openCloseContent("virtualFolder", virtualFolder); // Add custom filter QCString filterName = Config_getString(QHP_CUST_FILTER_NAME); if (!filterName.isEmpty()) { const char * tagAttributes[] = { "name", filterName, 0 }; m_doc.open("customFilter", tagAttributes); QCStringList customFilterAttributes = QCStringList::split(' ', Config_getString(QHP_CUST_FILTER_ATTRS)); for (int i = 0; i < (int)customFilterAttributes.count(); i++) { m_doc.openCloseContent("filterAttribute", customFilterAttributes[i]); } m_doc.close("customFilter"); } m_doc.open("filterSection"); // Add section attributes QCStringList sectionFilterAttributes = QCStringList::split(' ', Config_getString(QHP_SECT_FILTER_ATTRS)); if (!sectionFilterAttributes.contains("doxygen")) { sectionFilterAttributes << "doxygen"; } for (int i = 0; i < (int)sectionFilterAttributes.count(); i++) { m_doc.openCloseContent("filterAttribute", sectionFilterAttributes[i]); } m_toc.open("toc"); // Add extra root node QCString fullProjectname = getFullProjectName(); QCString indexFile = "index"+Doxygen::htmlFileExtension; const char * const attributes[] = { "title", fullProjectname, "ref", indexFile, NULL }; m_toc.open("section", attributes); m_prevSectionTitle = getFullProjectName(); m_prevSectionLevel = 1; m_sectionLevel = 1; m_index.open("keywords"); m_files.open("files"); }
int main(int argc, char **argv) { KAboutData about("kstcmd", I18N_NOOP("Kst Command Line"), "1.0", I18N_NOOP("Kst Command Line"), KAboutData::License_GPL, I18N_NOOP("(c) 2005-2006 The University of Toronto"), 0, "http://kst.kde.org/"); about.addAuthor("Staikos Computing Services Inc.", I18N_NOOP("Developed for the University of Toronto"), "*****@*****.**"); KCmdLineArgs::init(argc, argv, &about); KCmdLineArgs::addCmdLineOptions(options); KApplication a(false, false); QCString session; KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); if (args->count() > 0) { session = args->arg(0); } setvbuf(stdout, 0, _IONBF, 0); if (session.isEmpty()) { DCOPClient *client = KApplication::dcopClient(); QCStringList apps = client->registeredApplications(); QCStringList ksts; for (QCStringList::ConstIterator i = apps.begin(); i != apps.end(); ++i) { if ((*i).left(4) == "kst-") { ksts += *i; } } if (ksts.isEmpty()) { char *l = readline(_T("Kst does not appear to be running. Start a new session? ")); if (!l) { return ERR_NONE; } QString lstr = l; free(l); l = 0L; if (lstr.stripWhiteSpace().lower()[0] != 'y') { return ERR_NONE; } int pid = 0; QString err; int rc = KApplication::startServiceByDesktopName("kst", QString::null, &err, &session, &pid); if (rc != 0) { printf(_T("Error starting session: %s\n"), err.latin1()); return ERR_STARTING_SESSION; } if (session.isEmpty()) { session = QString("kst-%1").arg(pid).latin1(); } time_t startTime = time(NULL); printf("%s", _T("Waiting for Kst to start.")); while (!client->isApplicationRegistered(session)) { if (time(NULL) - startTime > 30) { printf("%s", _T("\nTimeout waiting for Kst to start\n")); return ERR_STARTING_SESSION; } printf("."); sleep(1); } printf("\n"); } else if (ksts.count() > 1) { QCString parentKst = QCString("kst-") + QString::number(getppid()).latin1(); if (ksts.contains(parentKst)) { session = parentKst; } else { printf("%s", _T("Please choose a session number to attach to:\n")); int j = 0; for (QCStringList::ConstIterator i = ksts.begin(); i != ksts.end(); ++i) { printf(_T("%2d: %s\n"), ++j, (*i).data()); } printf("> "); char choice[10]; QString l = fgets(choice, 4, stdin); l = l.stripWhiteSpace(); if (l.isEmpty()) { printf("%s", _T("No session found.\n")); return ERR_NO_SESSION; } bool ok = false; int nchoice = l.toInt(&ok); if (ok && nchoice > 0 && nchoice <= j) { session = ksts[nchoice - 1]; } else { printf("%s", _T("No session found.\n")); return ERR_NO_SESSION; } } } else { session = ksts[0]; } } DCOPRef ref(session.data(), "KstScript"); if (ref.isNull() || !KApplication::dcopClient()->registeredApplications().contains(ref.app())) { printf(_T("Error attaching to session %s\n"), session.data()); return ERR_ATTACHING; } printf(_T("Attached to Kst session %s\n"), session.data()); return run(ref); }