void ShellExt::buildSubMenu(const seafile::RepoInfo& repo, const std::string& path_in_repo) { insertSubMenuItem(SEAFILE_TR("get seafile download link"), GetShareLink); insertSubMenuItem(SEAFILE_TR("get seafile internal link"), GetInternalLink); std::unique_ptr<wchar_t[]> path_w(utils::utf8ToWString(path_)); bool is_dir = GetFileAttributesW(path_w.get()) & FILE_ATTRIBUTE_DIRECTORY; if (repo.support_private_share && is_dir) { insertSubMenuItem(SEAFILE_TR("share to a user"), ShareToUser); insertSubMenuItem(SEAFILE_TR("share to a group"), ShareToGroup); } if (repo.support_file_lock && !is_dir) { seafile::RepoInfo::Status status = getRepoFileStatus(repo.repo_id, path_in_repo, false); if (status == seafile::RepoInfo::LockedByMe) { insertSubMenuItem(SEAFILE_TR("unlock this file"), UnlockFile); } else if (status != seafile::RepoInfo::LockedByOthers) { insertSubMenuItem(SEAFILE_TR("lock this file"), LockFile); } } if (!is_dir) { insertSubMenuItem(SEAFILE_TR("view file history"), ShowHistory); } }
BOOL SHGetSpecialFolderPathU8(HWND hWnd, char *path, int csidl, BOOL fCreate) { Wstr path_w(MAX_PATH); if (!::SHGetSpecialFolderPathW(hWnd, path_w.Buf(), csidl, fCreate)) { return FALSE; } WtoU8(path_w.s(), path, MAX_PATH_U8); return TRUE; }
BOOL PlaySoundU8(const char *path, HMODULE hmod, DWORD flg) { Wstr path_w(path); return ::PlaySoundW(path_w.s(), hmod, flg); }