void frmMain::on_btnAbout_clicked()
{
    // Создаём форму "О программе":
    frmAbout fabout(this);
    // Проверяем, есть ли локализованная страничка поддержки разработчика,
    // и если есть - устанавливаем её:
    QString sLocSupport = getHelpDir() % "support.html";
    if (QFile::exists(sLocSupport))
    {
        sLocSupport.prepend(FILE_PROT);
        fabout.setSupportUrl("<a href=\"" % sLocSupport %
            "\">" % tr("Support page") % "</a>");
    }
    // Показываем форму "О программе" в диалоговом режиме:
    fabout.exec();
}
void frmMain::on_btnHelp_clicked()
{
    //MsgUtilsMy::showInfoMsg(this, getHelpDir());
    //return;
    // Показываем индексную страничку справки:
    QString sHelpIndex = getHelpDir() % HELP_INDEX;
    if (!QFile::exists(sHelpIndex))
    {
        // Не найден индексный файл справки. Сообщаем пользователю об ошибке:
        MsgUtilsMy::showErrorMsg(this, tr("Help index file not found. "
            "Try to reinstall the program."), QString(),
            tr("File not found: ") % sHelpIndex);
        return;
    }
    // Открываем индексный файл справки:
    QDesktopServices::openUrl(QUrl(FILE_PROT % sHelpIndex));
}
Example #3
0
void AboutOpera::writePaths( URL& url )
{
	OpString type, name;

	TRAPD(rc, g_languageManager->GetStringL(Str::SI_IDABOUT_OPERASYSINFO, name));
	if (OpStatus::IsSuccess(rc)) outHeading(url, name);
	url.WriteDocumentData(UNI_L(" <dl>"));

	TRAP(rc, g_languageManager->GetStringL(Str::SI_IDABOUT_SETTINGS, type));
	// This code makes the assumption that we're using PrefsFile and OpFile
# ifdef PREFS_READ
	PrefsFile *prefsfile  = (PrefsFile *) g_prefsManager->GetReader();
	OpFile    *inifile    = (OpFile *)    prefsfile->GetFile();
	rc = name.Set(inifile->GetFullPath());
# else
	rc = OpStatus::ERR_NOT_SUPPORTED;
# endif
	if (OpStatus::IsSuccess(rc))
	{
		cleanPath(name);
		outRow(url, type, name);
	}

#ifdef AUTOSAVE_WINDOWS
	TRAP(rc, g_languageManager->GetStringL(Str::SI_IDABOUT_DEFAULTWINFILE, type));
	if (OpStatus::IsSuccess(rc))
	{
		OpFile f;
		TRAP(rc, g_pcfiles->GetFileL(PrefsCollectionFiles::WindowsStorageFile, f));
		if (OpStatus::IsSuccess(rc)) rc = name.Set(f.GetFullPath());
		if (OpStatus::IsSuccess(rc))
		{
			cleanPath(name);
			outRow(url, type, name);
		}
	}
#endif // AUTOSAVE_WINDOWS

	TRAP(rc, g_languageManager->GetStringL(Str::SI_IDABOUT_HOTLISTFILE, type));
	if (OpStatus::IsSuccess(rc))
	{
		OpFile f;
		TRAP(rc, g_pcfiles->GetFileL(PrefsCollectionFiles::HotListFile, f));
		if (OpStatus::IsSuccess(rc)) rc = name.Set(f.GetFullPath());
		if (OpStatus::IsSuccess(rc))
		{
			cleanPath(name);
			outRow(url, type, name);
		}
	}

	TRAP(rc, g_languageManager->GetStringL(Str::SI_IDABOUT_OPERADIRECTORY, type));
	if (OpStatus::IsSuccess(rc))
	{
		rc = g_folder_manager->GetFolderPath(OPFILE_HOME_FOLDER, name);
		if (OpStatus::IsSuccess(rc))
		{
			cleanPath(name, TRUE);
			outRow(url, type, name);
		}
	}

	TRAP(rc, g_languageManager->GetStringL(Str::SI_IDABOUT_CACHEDIR, type));
	if (OpStatus::IsSuccess(rc))
	{
		rc = g_folder_manager->GetFolderPath(OPFILE_CACHE_FOLDER, name);
		if (OpStatus::IsSuccess(rc))
		{
			cleanPath(name, TRUE);
			outRow(url, type, name);
		}
	}

#ifdef M2_SUPPORT
	TRAP(rc, g_languageManager->GetStringL(Str::S_IDABOUT_HELPDIR, type)); // HELPDIR -> MAILDIR maybe
	if (OpStatus::IsSuccess(rc))
	{
		rc = g_folder_manager->GetFolderPath(OPFILE_MAIL_FOLDER, name);
		if (OpStatus::IsSuccess(rc))
		{
			cleanPath(name, TRUE);
			outRow(url, type, name);
		}
	}
#endif // M2_SUPPORT

	if (OpStatus::IsSuccess(getHelpDir(name)))
	{
		TRAP(rc, g_languageManager->GetStringL(Str::SI_IDABOUT_HELPDIR, type));
		if (OpStatus::IsSuccess(rc))
		{
			cleanPath(name, TRUE);
			outRow(url, type, name);
		}
	}

	// Plugin path:
	TRAP(rc, g_languageManager->GetStringL(Str::SI_IDABOUT_PLUGINPATH, type));
	if (OpStatus::IsSuccess(rc))
	{
		rc = name.Set(g_pcapp->GetStringPref(PrefsCollectionApp::PluginPath));
		if (!OpStatus::IsSuccess(rc)) name.Empty();

		while (name.Length())
		{
			int col = name.FindFirstOf(':');
			if (col == KNotFound)
			{
				cleanPath(name, TRUE);
				outRow(url, type, name);
				name.Empty();
			}
			else
			{
				OpString nom;
				if (OpStatus::IsSuccess(nom.Set(name.CStr(), col)))
				{
					cleanPath(nom, TRUE);
					outRow(url, type, nom);
				}
				// else: silent OOM :-(
				name.Delete(0, col+1);
			}
			type.Empty(); // only say "Plugin path:" on first row.
		}
#if 0 // 1 do we want to mention plugin path even if empty ?  Moose prefers not in bug #206083.
		if (type.Length())
		{
			OP_ASSERT(name.IsEmpty());
			outRow(url, type, name); // name is empty, which is what we want here ...
		}
#endif // mention plugin path even if empty
	}

#ifdef USER_JAVASCRIPT
	TRAP(rc, g_languageManager->GetStringL(Str::S_IDABOUT_USERJSFILE, type));
	if (OpStatus::IsSuccess(rc))
	{
		name.SetL(g_pcjs->GetStringPref(PrefsCollectionJS::UserJSFiles));
		/* This preference can be a comma-joined sequence of tokens, each of
		 * which is a directory or file and may have arbitrarily many ;-suffixes
		 * which may be either greasemonkey or opera (other things may be added
		 * to this list in future).  For now (2005/May, O8) this is unofficial -
		 * users are told it's just a single file or directory name - so we can
		 * just display it "as is"; but we'll eventually need to parse it as
		 * above and display it nicely.
		 */
		PosixNativeUtil::NativeString native_path (name.CStr());
		if (native_path.get() && access(native_path.get(), F_OK) == 0)
		{
			cleanPath(name, FALSE);
			outRow(url, type, name);
		}
	}
#endif // USER_JAVASCRIPT

#ifdef PREFS_USE_CSS_FOLDER_SCAN
	TRAP(rc, g_languageManager->GetStringL(Str::S_USER_CSS_LABEL, type));
	if (OpStatus::IsSuccess(rc))
	{
		OpString tmp_storage;
		name.Set(g_folder_manager->GetFolderPathIgnoreErrors(OPFILE_USERPREFSSTYLE_FOLDER, tmp_storage));
		cleanPath(name, FALSE);
		outRow(url, type, name);
	}
#endif // PREFS_USE_CSS_FOLDER_SCAN

	url.WriteDocumentData(UNI_L("\n </dl>\n"));
}
Example #4
0
void help(char *file) {
    char fullspec[PATH_MAX], *temp, *pt;

    if ( browser[0]=='\0' )
        findbrowser();
    if ( browser[0]=='\0' ) {
        gwwv_post_error(_("No Browser"),_("Could not find a browser. Set the BROWSER environment variable to point to one"));
        return;
    }

    if ( strstr(file,"http://")==NULL ) {
        memset(fullspec,0,sizeof(fullspec));
        if ( ! GFileIsAbsolute(file) )
            snprintf(fullspec, PATH_MAX, "%s", getHelpDir());
        strcat(fullspec,file);
        if (( pt = strrchr(fullspec,'#') )!=NULL ) *pt ='\0';
        if ( !GFileReadable( fullspec )) {
            if ( *file!='/' ) {
                strcpy(fullspec,"/usr/share/doc/fontforge/");
                strcat(fullspec,file);
                if (( pt = strrchr(fullspec,'#') )!=NULL ) *pt ='\0';
            }
        }
        if ( !GFileReadable( fullspec )) {
            strcpy(fullspec,"http://fontforge.sf.net/");
            AppendSupportedLocale(fullspec);
            strcat(fullspec,file);
        } else if ( pt!=NULL )
            *pt = '#';
    } else
        strncpy(fullspec,file,sizeof(fullspec));
#if __Mac
    if ( strcmp(browser,"open")==0 )
        /* open doesn't want "file:" prepended */;
    else
#endif
        if ( strstr(fullspec,":/")==NULL ) {
            if ( (temp=malloc(strlen(fullspec)+strlen("file:")+20))==NULL )
                return;
            sprintf(temp,"file:%s",fullspec);
            strncpy(fullspec,temp,sizeof(fullspec));
            fullspec[sizeof(fullspec)-1] = '\0';
            free(temp);
        }
#if __Mac
    /* This seems a bit easier... Thanks to riggle */
    if ( strcmp(browser,"open")==0 ) {
        char *str = "DYLD_LIBRARY_PATH=\"\"; open ";
        if ( (temp=malloc(strlen(str) + strlen(fullspec) + 20))==NULL )
            return;
        sprintf( temp, "%s \"%s\" &", str, fullspec );
        system(temp);
        free(temp);
    } else {
#else
    {
#endif
        if ( (temp=malloc(strlen(browser) + strlen(fullspec) + 20))==NULL )
            return;
        sprintf( temp, strcmp(browser,"kfmclient openURL")==0 ? "%s \"%s\" &" : "\"%s\" \"%s\" &", browser, fullspec );
        system(temp);
        free(temp);
    }
}
#endif

static void UI_IError(const char *format,...) {
    va_list ap;
    char buffer[300];
    va_start(ap,format);
    vsnprintf(buffer,sizeof(buffer),format,ap);
    GDrawIError("%s",buffer);
    va_end(ap);
}