void mnuCommandLinesAndParams(ArchiveManagerConfig* pCfg)
{
	Array<ArchiveFormat*> formats;
	pManager->GetFormats(formats);

	FarMenu menu(_M(MCommandLinesAndParamsArchiveFormat));

	for (unsigned int i = 0; i < formats.count(); i++)
	{
		ArchiveFormat* pFormat = formats[i];

		if ( pFormat->QueryCapability(AFF_SUPPORT_DEFAULT_COMMANDS) )
			menu.Add(pFormat->GetName(), 0, (void*)pFormat);
	}

	while ( true )
	{
		int nResult = menu.Run();

		if ( nResult != -1 )
		{
			ArchiveFormat* pFormat = (ArchiveFormat*)menu.GetData(nResult);
			dlgCommandLinesAndParams(pCfg, pFormat);
		}
		else
			break;
	}
}
Exemplo n.º 2
0
void CompressionOptionsWidget::updateWidgets()
{
    const KPluginMetaData metadata = PluginManager().preferredPluginFor(m_mimetype)->metaData();
    const ArchiveFormat archiveFormat = ArchiveFormat::fromMetadata(m_mimetype, metadata);
    Q_ASSERT(archiveFormat.isValid());

    if (archiveFormat.encryptionType() != Archive::Unencrypted) {
        collapsibleEncryption->setEnabled(true);
        collapsibleEncryption->setToolTip(QString());
        pwdWidget->setEnabled(true);

        if (archiveFormat.encryptionType() == Archive::HeaderEncrypted) {
            encryptHeaderCheckBox->setEnabled(true);
            encryptHeaderCheckBox->setToolTip(QString());
        } else {
            encryptHeaderCheckBox->setEnabled(false);
            // Show the tooltip only if the encryption is still enabled.
            // This is needed because if the new filter is e.g. tar, the whole encryption group gets disabled.
            if (collapsibleEncryption->isEnabled() && collapsibleEncryption->isExpanded()) {
                encryptHeaderCheckBox->setToolTip(i18n("Protection of the list of files is not possible with the %1 format.",
                                                       m_mimetype.comment()));
            } else {
                encryptHeaderCheckBox->setToolTip(QString());
            }
        }

    } else {
        collapsibleEncryption->setEnabled(false);
        collapsibleEncryption->setToolTip(i18n("Protection of the archive with password is not possible with the %1 format.",
                                               m_mimetype.comment()));
        pwdWidget->setEnabled(false);
        encryptHeaderCheckBox->setToolTip(QString());
    }


    if (archiveFormat.maxCompressionLevel() == 0) {
        collapsibleCompression->setEnabled(false);
        collapsibleCompression->setToolTip(i18n("It is not possible to set compression level for the %1 format.",
                                                m_mimetype.comment()));
    } else {
        collapsibleCompression->setEnabled(true);
        collapsibleCompression->setToolTip(QString());
        compLevelSlider->setMinimum(archiveFormat.minCompressionLevel());
        compLevelSlider->setMaximum(archiveFormat.maxCompressionLevel());
        if (m_opts.contains(QStringLiteral("CompressionLevel"))) {
            compLevelSlider->setValue(m_opts.value(QStringLiteral("CompressionLevel")).toInt());
        } else {
            compLevelSlider->setValue(archiveFormat.defaultCompressionLevel());
        }
    }

    if (archiveFormat.supportsMultiVolume()) {
        collapsibleMultiVolume->setEnabled(true);
        collapsibleMultiVolume->setToolTip(QString());
    } else {
        collapsibleMultiVolume->setEnabled(false);
        collapsibleMultiVolume->setToolTip(i18n("The %1 format does not support multi-volume archives.",
                                                m_mimetype.comment()));
    }
}
Exemplo n.º 3
0
void ArchivePanel::pGetOpenPluginInfo(
		OpenPluginInfo *pInfo
		)
{
	pInfo->StructSize = sizeof(OpenPluginInfo);

	pInfo->Flags = OPIF_USEFILTER | OPIF_USEHIGHLIGHTING | OPIF_USESORTGROUPS | OPIF_ADDDOTS;
	pInfo->CurDir = m_strPathInArchive;

	if ( m_pArchive )
	{
		ArchiveFormat *pFormat = m_pArchive->GetFormat();

		m_strPanelTitle.Format(
				_T(" %s%s%s%s%s "),
				pFormat->GetName(),
				_T(":"),
				FSF.PointToName(m_pArchive->GetFileName()),
				m_strPathInArchive.IsEmpty()?_T(""):_T("\\"),
				m_strPathInArchive.GetString()
				);

		pInfo->HostFile = m_pArchive->GetFileName();
		pInfo->PanelTitle = m_strPanelTitle;

		pInfo->InfoLines = m_pArchiveInfo;
		pInfo->InfoLinesNumber = m_nArchiveInfoItems;

		m_strShortcutData.Format(
				_T("%s%s%s"),
				GUID2STR(pFormat->GetUID()),
				GUID2STR(pFormat->GetPlugin()->GetUID()),
				GUID2STR(pFormat->GetModule()->GetUID())
				);

		pInfo->ShortcutData = m_strShortcutData;
	}
}
Exemplo n.º 4
0
void UpdateFormats(FarDialog* D, ArchivePlugin* pPlugin, ArchiveFilterEntry* pFE)
{
	int index = 0;

	D->ListDelete(ID_FOF_FORMATLIST, NULL);
	
	index = D->ListAddStr(ID_FOF_FORMATLIST, _T("All"));
	D->ListSetDataEx(ID_FOF_FORMATLIST, index, (void*)0, sizeof(void*));

	FarListPos pos;

	pos.SelectPos = 0; //all
	pos.TopPos = -1;

	if ( pPlugin )
	{
		if ( pPlugin->QueryCapability(APF_SUPPORT_SINGLE_FORMAT_QUERY) )
		{
			Array<ArchiveFormat*> formats;
			pPlugin->GetFormats(formats);  //BUGBUG

			for (unsigned int i = 0; i < formats.count(); i++)
			{
				ArchiveFormat* pFormat = formats[i];

				index = D->ListAddStr(ID_FOF_FORMATLIST, pFormat->GetName());
				D->ListSetDataEx(ID_FOF_FORMATLIST, index, (void*)pFormat, sizeof(void*));

				if ( pFE && !pFE->IsAllFormats() && pFE->GetFormat() && (pFE->GetFormat()->GetUID() == pFormat->GetUID()) )
					pos.SelectPos = index;
			}
		}
	}

	D->ListSetCurrentPos(ID_FOF_FORMATLIST, &pos);
}
Exemplo n.º 5
0
//бля, это пиздец
int ArchiveModuleManager::QueryArchives(
		const TCHAR* lpFileName,
		const unsigned char* pBuffer,
		DWORD dwBufferSize,
		Array<ArchiveFormat*>& result
		)
{
	bool bStopped = false;

	//BADBAD
	if ( !dwBufferSize )
	{
		result.reset();
		return 0;
	};

	ArchiveFilter* pFilter = m_pConfig->GetFilter();

	Array<ArchiveFilterEntry*> filters;

	pFilter->Reset();
	pFilter->QueryFilters(lpFileName, filters, bStopped);

	for (unsigned int i = 0; i < filters.count(); i++)
	{
		ArchiveFilterEntry* pFE = filters[i];
		ArchiveModule* pModule = pFE->GetModule();

		bool bNoPluginsFiltered = true;
		bool bNoFormatsFiltered = true;

		if ( !pFilter->Filtered(&pModule->GetUID(), NULL, NULL) )
		{
			if ( pFE->IsAllPlugins() )
			{
				Array<ArchivePlugin*>& plugins = pModule->GetPlugins();

				for (unsigned int i = 0; i < plugins.count(); i++)
				{
					ArchivePlugin* pPlugin = plugins[i];

					if ( !pFilter->Filtered(&pModule->GetUID(), &pPlugin->GetUID(), NULL) )
					{
						if ( pModule->QueryCapability(AMF_SUPPORT_SINGLE_PLUGIN_QUERY) )
						{
							Array<ArchiveFormat*>& formats = pPlugin->GetFormats();

							for (unsigned int j = 0; j < formats.count(); j++)
							{
								ArchiveFormat* pFormat = formats[i];

								if ( !pFilter->Filtered(&pModule->GetUID(), &pPlugin->GetUID(), &pFormat->GetUID()) )
								{
									if ( pPlugin->QueryCapability(APF_SUPPORT_SINGLE_FORMAT_QUERY) )
										pModule->QueryArchives(&pPlugin->GetUID(), &pFormat->GetUID(), lpFileName, pBuffer, dwBufferSize, result);
								}
								else
									bNoFormatsFiltered = false;
							}

							if ( bNoFormatsFiltered && !pPlugin->QueryCapability(APF_SUPPORT_SINGLE_FORMAT_QUERY) )
								pModule->QueryArchives(&pPlugin->GetUID(), NULL, lpFileName, pBuffer, dwBufferSize, result);
						}
						else
							bNoPluginsFiltered = false;
					}

					if ( bNoPluginsFiltered && !pModule->QueryCapability(AMF_SUPPORT_SINGLE_PLUGIN_QUERY) )
						pModule->QueryArchives(NULL, NULL, lpFileName, pBuffer, dwBufferSize, result);
				}
			}
			else
			{
				if ( pFE->IsAllFormats() )
				{
					ArchivePlugin* pPlugin = pFE->GetPlugin();
				
					if ( !pFilter->Filtered(&pModule->GetUID(), &pPlugin->GetUID(), NULL) )
					{
						Array<ArchiveFormat*>& formats = pPlugin->GetFormats();

						for (unsigned int i = 0; i < formats.count(); i++)
						{
							ArchiveFormat* pFormat = formats[i];

							if ( !pFilter->Filtered(&pModule->GetUID(), &pPlugin->GetUID(), &pFormat->GetUID()) )
							{
								if ( pPlugin->QueryCapability(APF_SUPPORT_SINGLE_FORMAT_QUERY) )
									pModule->QueryArchives(&pPlugin->GetUID(), &pFormat->GetUID(), lpFileName, pBuffer, dwBufferSize, result);
							}
							else
								bNoFormatsFiltered = false;

						}

						if ( bNoFormatsFiltered && !pPlugin->QueryCapability(APF_SUPPORT_SINGLE_FORMAT_QUERY) )
							pModule->QueryArchives(&pPlugin->GetUID(), NULL, lpFileName, pBuffer, dwBufferSize, result);
					}
				}
				else
				{
					ArchiveFormat* pFormat = pFE->GetFormat();
					ArchivePlugin* pPlugin = pFE->GetPlugin();

					if ( !pFilter->Filtered(&pModule->GetUID(), &pPlugin->GetUID(), &pFormat->GetUID()) )
					{
						if ( pPlugin->QueryCapability(APF_SUPPORT_SINGLE_FORMAT_QUERY) )
							pModule->QueryArchives(&pPlugin->GetUID(), &pFormat->GetUID(), lpFileName, pBuffer, dwBufferSize, result);
					}
				}
			}
		}

		pFilter->AddStopFilter(filters[i]);
	}

	if ( !bStopped && pFilter->UseRemaining() )
	{
		for (unsigned int i = 0; i < m_pModules.count(); i++)
		{
			bool bNoPluginsFiltered = true;
			bool bNoFormatsFiltered = true;

			ArchiveModule* pModule = m_pModules[i]; 

			if ( !pFilter->Filtered(&pModule->GetUID(), NULL, NULL) )
			{
				Array<ArchivePlugin*>& plugins = pModule->GetPlugins();

				for (unsigned int j = 0; j < plugins.count(); j++)
				{
					ArchivePlugin* pPlugin = plugins[j];

					if ( !pFilter->Filtered(&pModule->GetUID(), &pPlugin->GetUID(), NULL) )
					{
						Array<ArchiveFormat*>& formats = pPlugin->GetFormats();

						for (unsigned int k = 0; k < formats.count(); k++)
						{
							ArchiveFormat* pFormat = formats[k];

							if ( !pFilter->Filtered(&pModule->GetUID(), &pPlugin->GetUID(), &pFormat->GetUID()) )
							{
								if ( pPlugin->QueryCapability(APF_SUPPORT_SINGLE_FORMAT_QUERY) )
									pModule->QueryArchives(&pPlugin->GetUID(), &pFormat->GetUID(), lpFileName, pBuffer, dwBufferSize, result);
							}
							else
								bNoFormatsFiltered = false;
						}

						if ( bNoFormatsFiltered && !pPlugin->QueryCapability(APF_SUPPORT_SINGLE_FORMAT_QUERY) )
							pModule->QueryArchives(&pPlugin->GetUID(), NULL, lpFileName, pBuffer, dwBufferSize, result);

					}
					else
						bNoPluginsFiltered = false;
				}

				if ( bNoPluginsFiltered && !pModule->QueryCapability(AMF_SUPPORT_SINGLE_PLUGIN_QUERY) )
					pModule->QueryArchives(NULL, NULL, lpFileName, pBuffer, dwBufferSize, result);
			}
		}
	}

	return 0;
}