Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions OpenWith/configs/OpenWithEng.lng
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

"OpenWith"
"OpenWith: Choose application"
"OpenWith for "
" file(s)"

"&OK"
"&Cancel"
"OpenWith Error"
"Selected item must be a file accessible locally via a real path."
"Failed to save configuration."
"Failed to save modified settings; the changes will apply to the current session only."
"No applications found. Detected MIME type:"
"The application cannot be executed."
"OpenWith plugin is not available on this platform."
Expand All @@ -18,6 +20,7 @@
"Don't &wait for command completion"
"C&lear selection if command executed"
"Co&nfirm opening if file count exceeds:"
"Displa&y filename in the menu title"

"Use `&xdg-mime` tool"
"Use `&file` tool"
Expand All @@ -38,9 +41,9 @@

"OpenWith: Details"

"&Filepath:"
"files selected: "
"&MIME profile:"
"F&iles selected:"
"&Filepaths:"
"&MIME profiles:"
"L&aunch command:"
"&Close"
"&Launch"
Expand Down
13 changes: 8 additions & 5 deletions OpenWith/configs/OpenWithRus.lng
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

"OpenWith"
"OpenWith: Выберите приложение"
"OpenWith для "
" файл(ов)"

"&ОК"
"О&тмена"
"Ошибка OpenWith"
"Выбранный объект должен быть файлом, доступным локально по реальному пути."
"Ошибка записи конфигурации."
"Не удалось сохранить измененные настройки; они будут действовать только в текущем сеансе."
"Приложения не найдены. Распознанный MIME-тип:"
"Невозможно выполнить приложение."
"Плагин OpenWith недоступен на данной платформе."
Expand All @@ -18,6 +20,7 @@
"Не ждать &завершения команды"
"&Снимать выделение, если выбрана команда"
"По&дтверждать открытие, если файлов больше чем:"
"Отображать им&я открываемого файла в заголовке меню"

"Использовать утилиту `&xdg-mime`"
"Использовать утилиту `&file`"
Expand All @@ -38,12 +41,12 @@

"OpenWith: Подробности"

"Адрес &файла:"
"выбрано файлов: "
"&MIME-профиль:"
"В&ыбрано файлов:"
"Адреса &файлов:"
"&MIME-профили:"
"&Команда запуска:"
"&Закрыть"
"З&апустить"
"За&пустить"

"&Desktop файл:"
"&Источник:"
Expand Down
113 changes: 73 additions & 40 deletions OpenWith/configs/help_en.hlf

Large diffs are not rendered by default.

129 changes: 81 additions & 48 deletions OpenWith/configs/help_ru.hlf

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions OpenWith/src/AppProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@

std::unique_ptr<AppProvider> AppProvider::CreateAppProvider(TMsgGetter msg_getter)
{
std::unique_ptr<AppProvider> provider = nullptr;
#ifdef __linux__
provider = std::make_unique<XDGBasedAppProvider>(msg_getter);
#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
return std::make_unique<XDGBasedAppProvider>(msg_getter);
#elif defined(__APPLE__)
provider = std::make_unique<MacOSAppProvider>(msg_getter);
#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
provider = std::make_unique<XDGBasedAppProvider>(msg_getter);
return std::make_unique<MacOSAppProvider>(msg_getter);
#else
return nullptr;
#endif
}

if (provider) {
provider->LoadPlatformSettings();
}

return provider;
}
AppProvider* AppProvider::GetInstance(TMsgGetter msg_getter)
{
static auto s_provider = CreateAppProvider(msg_getter);
return s_provider.get();
}
20 changes: 13 additions & 7 deletions OpenWith/src/AppProvider.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@

struct ProviderSetting
{
std::wstring internal_key;
std::wstring display_name;
std::wstring internal_key; // persistent INI key and internal identifier
std::wstring display_name; // localized UI label
bool value;
bool disabled = false; // true if the setting should be grayed out in the UI
bool affects_candidates = true; // true if changing this setting affects the contents or order of the candidate list
bool disabled; // true if the setting should be grayed out in the UI
bool affects_candidates; // true if changing this setting affects the contents or order of the candidate list
};

class KeyFileReadHelper;
class KeyFileHelper;

class AppProvider
{
Expand All @@ -26,7 +28,7 @@ class AppProvider
explicit AppProvider(TMsgGetter msg_getter) : m_GetMsg(std::move(msg_getter)) {}
virtual ~AppProvider() = default;

static std::unique_ptr<AppProvider> CreateAppProvider(TMsgGetter msg_getter);
static AppProvider* GetInstance(TMsgGetter msg_getter = nullptr);

virtual std::vector<CandidateInfo> GetAppCandidates(const std::vector<std::wstring>& filepaths) = 0;
virtual std::vector<std::wstring> GetMimeTypes() = 0;
Expand All @@ -35,9 +37,13 @@ class AppProvider

virtual std::vector<ProviderSetting> GetPlatformSettings() { return {}; }
virtual void SetPlatformSettings(const std::vector<ProviderSetting>& settings) { }
virtual void LoadPlatformSettings() { }
virtual void SavePlatformSettings() { }
virtual void LoadPlatformSettings(const KeyFileReadHelper& key_reader) { }
virtual void SavePlatformSettings(KeyFileHelper& key_writer) { }


protected:
TMsgGetter m_GetMsg;

private:
static std::unique_ptr<AppProvider> CreateAppProvider(TMsgGetter msg_getter);
};
Loading
Loading