Ejemplo n.º 1
0
/*
 * Set up the agent if running as a daemon.
 */
int
main(int argc, char **argv)
{
	int err = 0;
	char log_file[] = "pmda_ctdb.log";
	pmdaInterface dispatch;

	__pmSetProgname(argv[0]);

	pmdaDaemon(&dispatch, PMDA_INTERFACE_2, pmProgname, CTDB,
		   log_file, helpfile());

	if (pmdaGetOpt(argc, argv, "d:i:l:pu:?", &dispatch, &err) != EOF) {
		err++;
	}

	if (err) {
		usage();
	}

	pmdaOpenLog(&dispatch);
	pmda_ctdb_init(&dispatch);
	pmdaConnect(&dispatch);
	pmdaMain(&dispatch);

	exit(0);
}
Ejemplo n.º 2
0
int main(int argc, char** argv)
{
	std::string line;
	std::ifstream helpfile("help.txt");

	if (helpfile.is_open())	{
		while (getline(helpfile, line)) {
			std::cout << line << "\n"; // Write to console
			helpText.push_back(line); // Save text for later as well
		}
	}
	else {
		std::cout << "help.txt missing!";
		helpText.push_back("help.txt missing!");
	}
	helpfile.close();

	#ifdef _WIN32
		system("PAUSE"); // "Press any key to continue"
	#endif

	srand(time(NULL));

	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
	glutInitWindowSize(600, 720); // Start Windowed
	glutCreateWindow("Interactive Screensaver");

	init();
	glutDisplayFunc(display);
	glutReshapeFunc(reshape);
	glutKeyboardFunc(keyboard);
	glutMouseFunc(mouse);
	glutPassiveMotionFunc(mousePassive); // for direction indicators in click mode
	glutMotionFunc(mousePassive); // for direction indicators in drag mode
	glutTimerFunc(16, timer, 0);

	int colourSubMenu = glutCreateMenu(colourMenu);
	glutAddMenuEntry("Random", RANDOMCOLOUR);
	glutAddMenuEntry("Red", RED);
	glutAddMenuEntry("Green", GREEN);
	glutAddMenuEntry("Blue", BLUE);
	glutAddMenuEntry("Yellow", YELLOW);
	glutAddMenuEntry("Magenta", MAGENTA);
	glutAddMenuEntry("Teal", TEAL);
	glutAddMenuEntry("Orange", ORANGE);
	glutAddMenuEntry("Pink", PINK);
	glutAddMenuEntry("Purple", PURPLE);
	glutAddMenuEntry("White", WHITE);

	glutCreateMenu(menu);
	glutAddSubMenu("Set Colour", colourSubMenu);
	glutAddMenuEntry("Quit Program", 'q');
	glutAttachMenu(GLUT_RIGHT_BUTTON);

	glutMainLoop();
	return(0);
}
Ejemplo n.º 3
0
void WebFrame::OnLoadScheme(wxCommandEvent& WXUNUSED(evt))
{
    wxFileName helpfile("../help/doc.zip");
    helpfile.MakeAbsolute();
    wxString path = helpfile.GetFullPath();
    //Under MSW we need to flip the slashes
    path.Replace("\\", "/");
    path = "wxfs:///" + path + ";protocol=zip/doc.htm";
    m_browser->LoadURL(path);
}
Ejemplo n.º 4
0
RfkHelp::RfkHelp() {

#ifdef Q_WS_HILDON
  // Under Maemo, this is a stacked window.
  this->setAttribute(Qt::WA_Maemo5StackedWindow);
#endif

  QFile helpfile(":/resources/help.html");
  helpfile.open(QIODevice::ReadOnly|QIODevice::Text);
  QString help = helpfile.readAll();
  helpfile.close();

  this->setReadOnly(true);
  this->setHtml(help);
}
Ejemplo n.º 5
0
void ISFSetupWin::create_ise_help_main (gint type, char *name, char *title)
{
    if (!_ise_help_win)
        _ise_help_win = new ISFHelpWin ();
    if (!_ise_help_win)
        return;

    TOOLBAR_MODE_T mode = TOOLBAR_MODE_T (type);
    // for mutually exclusive ISEs
    if (TOOLBAR_HELPER_MODE == mode) {
        String help_filename, help_line;

        if (TOOLBAR_HELPER_MODE == mode) {
            help_filename = String (SCIM_MODULE_PATH) + String (SCIM_PATH_DELIM_STRING)
                            + String (SCIM_BINARY_VERSION) + String (SCIM_PATH_DELIM_STRING) + String ("Helper")
                            + String (SCIM_PATH_DELIM_STRING) + String (name)
                            + String (".help");
        }

        std::ifstream helpfile (help_filename.c_str ());
        if (!helpfile) {
            std::cerr << "Can't open help file : " << help_filename << "!!!!!!!!!! \n";

            help_line = String (_("Input Service Framework ")) +
                        String (_("\n(C) 2008 SAMSUNG")) +
                        String (_("\n\n Help file is needed!!"));
        } else {
            /* FIXME -- 256 char per line for now -- */
            char str[256];
            while (helpfile.getline (str, sizeof (str))) {
                help_line = help_line + String (str) + String("\n");
            }
            helpfile.close ();
        }
        _ise_help_win->show_help (title, (char *)help_line.c_str ());
    } else {
        // FIXME
        _ise_help_win->show_help (title, (char *)_keyboard_ise_help_map[String(name)].c_str ());
    }
}
Ejemplo n.º 6
0
Archivo: ndhelp.c Proyecto: Orc/ndialog
/*
 * _nd_help() displays helpfiles
 */
void
_nd_help(char *document)
{
    STRING(Page) pages;
    Page *cur, *up = 0;
    int rc;
    void *help, *chain;
    char *topic;		/* help topic title, for putting on the
				 * help box titlebar*/

    if (document == 0)
	return;

    CREATE(pages);

    cur = &EXPAND(pages);
    
    cur->cursor = 0;
    cur->file = helpfile(document, root);

    do {
	help = newHelp(0, 0, (COLS*3)/4, LINES-10,
		       cur->file, (pfo)ndhcallback, 0);

	/*setObjTitle(help, cur->file);*/

	if (cur->cursor)
	    setHelpCursor(help, cur->cursor);

	chain = ObjChain(help, newCancelButton(0,"Done", 0, 0));

	rc = MENU(chain, -1, -1, getHelpTopic(help), 0, 0);

	if (rc == MENU_OK) {
	    if (( topic = currentHtmlTag(help) )) {
		cur->cursor = getHelpCursor(help);

		up = cur;
		cur = &EXPAND(pages);
		cur->cursor = 0;
		cur->file = helpfile(topic, up ? up->file : root);
	    }
	}
	else if (rc == MENU_ESCAPE) {
	    free(cur->file);
	    S(pages)--;
	    up = (S(pages) > 1) ? &T(pages)[S(pages)-2]:0;
	    cur = &T(pages)[S(pages)-1];
	}
	else if (rc == MENU_CANCEL) {
	    int i;
	    for (i = 0; i < S(pages); i++)
		free(T(pages)[i].file);
	}
	deleteObjChain(chain);
    } while ( S(pages) > 0 );
    DELETE(pages);
#if HAVE_DOUPDATE
    doupdate();
#else
    refresh();
#endif
} /* _nd_help */
Ejemplo n.º 7
0
void HelpPlugin::LaunchHelp(const wxString &c_helpfile, bool isExecutable, bool openEmbeddedViewer, HelpCommon::StringCase keyCase, const wxString &defkeyword, const wxString &c_keyword)
{
  const static wxString http_prefix(_T("http://"));
  const static wxString man_prefix(_T("man:"));
  wxString helpfile(c_helpfile);

  // Patch by Yorgos Pagles: Use the new attributes to calculate the keyword
  wxString keyword = c_keyword.IsEmpty() ? defkeyword : c_keyword;

  if(keyCase == HelpCommon::UpperCase)
  {
    keyword.MakeUpper();
  }
  else if (keyCase == HelpCommon::LowerCase)
  {
    keyword.MakeLower();
  }

  helpfile.Replace(_T("$(keyword)"), keyword);
  Manager::Get()->GetMacrosManager()->ReplaceMacros(helpfile);

  if (isExecutable)
  {
    Manager::Get()->GetLogManager()->DebugLog(_T("Executing ") + helpfile);
    wxExecute(helpfile);
    return;
  }

  // Support C::B scripts
  if (wxFileName(helpfile).GetExt() == _T("script"))
  {
      if (Manager::Get()->GetScriptingManager()->LoadScript(helpfile))
      {
        // help scripts must contain a function with the following signature:
        // function SearchHelp(keyword)
        try
        {
            SqPlus::SquirrelFunction<void> f("SearchHelp");
            f(keyword);
        }
        catch (SquirrelError& e)
        {
            Manager::Get()->GetScriptingManager()->DisplayErrors(&e);
        }
      }
      else
      {
        Manager::Get()->GetLogManager()->DebugLog(_T("Couldn't run script"));
      }

      return;
  }

  // Operate on help html file links inside embedded viewer
  if (openEmbeddedViewer && wxFileName(helpfile).GetExt().Mid(0, 3).CmpNoCase(_T("htm")) == 0)
  {
    Manager::Get()->GetLogManager()->DebugLog(_T("Launching ") + helpfile);
    cbMimePlugin* p = Manager::Get()->GetPluginManager()->GetMIMEHandlerForFile(helpfile);
    if (p)
    {
        p->OpenFile(helpfile);
    }
    else
    {
        reinterpret_cast<MANFrame *>(m_manFrame)->LoadPage(helpfile);
        ShowMANViewer();
    }
    return;
  }

  // Operate on help http (web) links
  if (helpfile.Mid(0, http_prefix.size()).CmpNoCase(http_prefix) == 0)
  {
    Manager::Get()->GetLogManager()->DebugLog(_T("Launching ") + helpfile);
    wxLaunchDefaultBrowser(helpfile);
    return;
  }

  // Operate on man pages
  if (helpfile.Mid(0, man_prefix.size()).CmpNoCase(man_prefix) == 0)
  {
    if (reinterpret_cast<MANFrame *>(m_manFrame)->SearchManPage(c_helpfile, keyword))
    {
        Manager::Get()->GetLogManager()->DebugLog(_T("Couldn't find man page"));
    }
    else
    {
        Manager::Get()->GetLogManager()->DebugLog(_T("Launching man page"));
    }

    ShowMANViewer();
    return;
  }

  wxFileName the_helpfile = wxFileName(helpfile);
  Manager::Get()->GetLogManager()->DebugLog(_T("Help File is ") + helpfile);

  if (!(the_helpfile.FileExists()))
  {
    wxString msg;
    msg << _("Couldn't find the help file:\n")
        << the_helpfile.GetFullPath() << _("\n")
        << _("Do you want to run the associated program anyway?");
    if (!(cbMessageBox(msg, _("Warning"), wxICON_WARNING | wxYES_NO | wxNO_DEFAULT) == wxID_YES));
        return;
  }

  wxString ext = the_helpfile.GetExt();

#ifdef __WXMSW__
  // Operate on help files with keyword search (windows only)
  if (!keyword.IsEmpty())
  {
  	if (ext.CmpNoCase(_T("hlp")) == 0)
  	{
      wxWinHelpController HelpCtl;
      HelpCtl.Initialize(helpfile);
      HelpCtl.KeywordSearch(keyword);
      return;
  	}

  	if (ext.CmpNoCase(_T("chm")) == 0)
  	{
      LaunchCHMThread *p_thread = new LaunchCHMThread(helpfile, keyword);
      p_thread->Create();
      p_thread->Run();
      return;
  	}
  }
#endif

  // Just call it with the associated program
  wxFileType *filetype = wxTheMimeTypesManager->GetFileTypeFromExtension(ext);

  if (!filetype)
  {
    cbMessageBox(_("Couldn't find an associated program to open:\n") +
      the_helpfile.GetFullPath(), _("Warning"), wxOK | wxICON_EXCLAMATION);
    return;
  }

  wxExecute(filetype->GetOpenCommand(helpfile));
  delete filetype;
}
Ejemplo n.º 8
0
int main( int argc, char *[] )
{
    if( argc < 2 || argc > 3 ) {
        HCWarning( USAGE );
        return( -1 );
    }

    // Parse the command line.
    char    cmdline[80];
    char    *pfilename, *temp;
    int     quiet = 0;

    getcmd( cmdline );
    temp = cmdline;
    pfilename = NULL;
    while( *temp != '\0' && isspace( *temp ) ) {
        temp++;
    }
    if( *temp == '-' || *temp == '/' ) {
        temp++;
        if( (*temp != 'q' && *temp != 'Q') || !isspace( *(temp+1) ) ) {
            HCWarning( USAGE );
            return( -1 );
        } else {
            quiet = 1;
            temp++;
            while( *temp != '\0' && isspace( *temp ) ) {
                temp++;
            }
            if( *temp == '\0' ) {
                HCWarning( USAGE );
                return( -1 );
            } else {
                pfilename = temp;
            }
        }
    } else if( *temp != '\0' ) {
        pfilename = temp++;
        while( *temp != '\0' && *temp != '/' && *temp != '-' ) {
            temp++;
        }
        if( *temp != '\0' ) {
            *temp = '\0';
            temp++;
            if( *temp != 'q' && *temp != 'Q' ) {
                HCWarning( USAGE );
                return( -1 );
            } else {
                temp++;
                while( *temp != '\0' && isspace( *temp ) ) {
                    temp++;
                }
                if( *temp != '\0' ){
                    HCWarning( USAGE );
                    return( -1 );
                } else {
                    quiet = 1;
                }
            }
        }
    }

    SetQuiet( quiet );


    //  Parse the given filename.

    char    path[_MAX_PATH];
    char    drive[_MAX_DRIVE];
    char    dir[_MAX_DIR];
    char    fname[_MAX_FNAME];
    char    ext[_MAX_EXT];

    _fullpath( path, pfilename, _MAX_PATH );
    _splitpath( path, drive, dir, fname, ext );

    if( stricmp( ext, PhExt ) == 0 || stricmp( ext, HlpExt ) == 0 ) {
        HCWarning( BAD_EXT );
        return( -1 );
    }
    if( ext[0] == '\0' ){
        _makepath( path, drive, dir, fname, HpjExt );
    }

    char    destpath[_MAX_PATH];
    _makepath( destpath, drive, dir, fname, HlpExt );

    InFile  input( path );
    if( input.bad() ) {
        HCWarning( FILE_ERR, pfilename );
        return( -1 );
    }


    //  Set up and start the help compiler.

    try {
        HFSDirectory    helpfile( destpath );
        HFFont          fontfile( &helpfile );
        HFContext       contfile( &helpfile );
        HFSystem        sysfile( &helpfile, &contfile );
        HFCtxomap       ctxfile( &helpfile, &contfile );
        HFTtlbtree      ttlfile( &helpfile );
        HFKwbtree       keyfile( &helpfile );
        HFBitmaps       bitfiles( &helpfile );

        Pointers        my_files = {
                            NULL,
                            NULL,
                            &sysfile,
                            &fontfile,
                            &contfile,
                            &ctxfile,
                            &keyfile,
                            &ttlfile,
                            &bitfiles,
        };

        if( stricmp( ext, RtfExt ) == 0 ) {
            my_files._topFile = new HFTopic( &helpfile );
            RTFparser   rtfhandler( &my_files, &input );
            rtfhandler.Go();
        } else {
            HPJReader   projfile( &helpfile, &my_files, &input );
            projfile.parseFile();
        }

        helpfile.dump();
        if( my_files._topFile != NULL ) {
            delete my_files._topFile;
        }
        if( my_files._phrFile != NULL ) {
            delete my_files._phrFile;
        }
    }
    catch( HCException ) {
        HCWarning( PROGRAM_STOPPED );
        return( -1 );
    }
    return( 0 );
}
Ejemplo n.º 9
0
checkForUpdates::checkForUpdates(QWidget* parent, Qt::WFlags fl)
    : XWidget(parent, fl)
{
  setupUi(this);

  QUrl updatequrl("http://updates.xtuple.com/checkForUpdates.php");
  updatequrl.addQueryItem("xtuple", _Version);

  XSqlQuery versions;
  versions.exec("SELECT version() AS pgver,"
                "       fetchMetricText('ServerVersion') AS dbver,"
                "       fetchMetricText('Application') AS dbprod;");
  if(versions.first())
  {
    updatequrl.addQueryItem("postgres", versions.value("pgver").toString());
    updatequrl.addQueryItem(versions.value("dbprod").toString(),
                            versions.value("dbver").toString());
  }
  else if (versions.lastError().type() != QSqlError::NoError)
    systemError(this, versions.lastError().text(), __FILE__, __LINE__);
  // no return - let's learn as much as we can

#ifdef Q_WS_MACX
  QString helpdir = QApplication::applicationDirPath() +
                    "/../Resources/helpXTupleGUIClient";
#else
  QString helpdir = QApplication::applicationDirPath() + "helpXTupleGUIClient";
#endif
  QFile helpfile(helpdir + "/index.html");
  QString helpver;
  if (helpfile.exists())
  {
    if (helpfile.open(QIODevice::ReadOnly))
    {
      QXmlQuery helpverq;
      if (helpverq.setFocus(&helpfile))
      {
        helpverq.setQuery("/descendant::p[attribute::class='releaseinfo']/text()/string()");
        if (helpverq.isValid())
        {
          QStringList helpverlist;
          if (helpverq.evaluateTo(&helpverlist) && ! helpverlist.isEmpty())
            helpver = helpverlist.at(0);
          else if (DEBUG)
            qDebug("Could not find the releaseinfo in %s",
                     qPrintable(helpfile.fileName()));
        }
        else if (DEBUG)
          qDebug("The helpver query is not valid for some reason");
      }
      else if (DEBUG)
        qDebug("Could not set focus on the help file %s",
                 qPrintable(helpfile.fileName()));
    }
    else if (DEBUG)
      qDebug("Found the help file %s but could not open it: %s",
               qPrintable(helpfile.fileName()),
               qPrintable(helpfile.errorString()));
  }
  else if (DEBUG)
    qDebug("The help file %s does not exist", qPrintable(helpfile.fileName()));
  updatequrl.addQueryItem("xTupleHelp", helpver);

  QStringList context;
  context << "xTuple" << "openrpt" << "reports"; // duplicated from main.cpp!

  versions.exec("SELECT pkghead_name, pkghead_version"
                "  FROM pkghead"
                " WHERE packageisenabled(pkghead_id);");
  while(versions.next())
  {
    updatequrl.addQueryItem(versions.value("pkghead_name").toString(),
                            versions.value("pkghead_version").toString());
    context << versions.value("pkghead_name").toString();
  }
  if (versions.lastError().type() != QSqlError::NoError)
    systemError(this, versions.lastError().text(), __FILE__, __LINE__);
  // no return - let's learn as much as we can

  // get all of the locales on the system
  versions.exec("SELECT DISTINCT lang_abbr2, country_abbr"
                "  FROM locale"
                "  JOIN lang ON (locale_lang_id=lang_id)"
                "  LEFT OUTER JOIN country ON (locale_country_id=country_id)"
                " ORDER BY lang_abbr2, country_abbr;");
  QStringList locale;
  while(versions.next())
  {
    QString tmp = versions.value("lang_abbr2").toString();
    if (! versions.value("country_abbr").isNull())
      tmp += "_" + versions.value("country_abbr").toString();
    locale.append(tmp);
  }
  if (! locale.isEmpty())
    updatequrl.addQueryItem("locales", locale.join(","));
  else if(versions.lastError().type() != QSqlError::NoError)
    systemError(this, versions.lastError().text(), __FILE__, __LINE__);

  // maybe i want to update just _my_ translation file
  versions.exec("SELECT lang_abbr2, country_abbr"
                "  FROM locale"
                "  JOIN usr ON (locale_id=usr_locale_id)"
                "  JOIN lang ON (locale_lang_id=lang_id)"
                "  LEFT OUTER JOIN country ON (locale_country_id=country_id)"
                " WHERE (usr_username=getEffectiveXtUser());");
  if (versions.first())
  {
    QString tmp = versions.value("lang_abbr2").toString();
    if (! versions.value("country_abbr").isNull())
      tmp += "_" + versions.value("country_abbr").toString();
    updatequrl.addQueryItem("mylocale", tmp);
  }
  else if(versions.lastError().type() != QSqlError::NoError)
    systemError(this, versions.lastError().text(), __FILE__, __LINE__);

  QString qmparam = "qm.%1.%2";
  for (int l = 0; l < locale.length(); l++)
  {
    for (int c = 0; c < context.length(); c++)
    {
      QString version("");
      QString tf = translationFile(locale.at(l), context.at(c), version);
      updatequrl.addQueryItem(qmparam.arg(context.at(c), locale.at(l)), version);
    }
  }

  if (DEBUG)
    qDebug("checkForUpdates::checkForUpdates() sending %s",
           updatequrl.toEncoded().data());

  _view->load(updatequrl);
}