allow opening parent/enclosing doc with native editor in reslist
This commit is contained in:
+2
-3
@@ -24,9 +24,8 @@ using std::string;
|
||||
// indexer). Document Ids are built from a concatenation of the file
|
||||
// path and the internal path (ie: email number inside
|
||||
// folder/attachment number/etc.) As the size of Xapian terms is
|
||||
// limited, the path is truncated to a maximum length, and completed
|
||||
// by a hash of the remainder. So the unique id looks like:
|
||||
// /some/truncated/paHASHVALUE|ipath
|
||||
// limited, the Id path is truncated to a maximum length, and completed
|
||||
// by a hash of the remainder (including the ipath)
|
||||
|
||||
extern void make_udi(const string& fn, const string& ipath, string &udi);
|
||||
|
||||
|
||||
+28
-8
@@ -176,13 +176,13 @@ TempFileInternal::~TempFileInternal()
|
||||
}
|
||||
|
||||
|
||||
void path_catslash(std::string &s) {
|
||||
void path_catslash(string &s) {
|
||||
if (s.empty() || s[s.length() - 1] != '/')
|
||||
s += '/';
|
||||
}
|
||||
|
||||
std::string path_cat(const std::string &s1, const std::string &s2) {
|
||||
std::string res = s1;
|
||||
string path_cat(const string &s1, const string &s2) {
|
||||
string res = s1;
|
||||
path_catslash(res);
|
||||
res += s2;
|
||||
return res;
|
||||
@@ -274,7 +274,7 @@ extern string path_tildexpand(const string &s)
|
||||
return o;
|
||||
}
|
||||
|
||||
extern std::string path_absolute(const std::string &is)
|
||||
extern string path_absolute(const string &is)
|
||||
{
|
||||
if (is.length() == 0)
|
||||
return is;
|
||||
@@ -290,7 +290,7 @@ extern std::string path_absolute(const std::string &is)
|
||||
}
|
||||
|
||||
#include <smallut.h>
|
||||
extern std::string path_canon(const std::string &is)
|
||||
extern string path_canon(const string &is)
|
||||
{
|
||||
if (is.length() == 0)
|
||||
return is;
|
||||
@@ -330,8 +330,8 @@ extern std::string path_canon(const std::string &is)
|
||||
|
||||
#include <glob.h>
|
||||
#include <sys/stat.h>
|
||||
list<std::string> path_dirglob(const std::string &dir,
|
||||
const std::string pattern)
|
||||
list<string> path_dirglob(const string &dir,
|
||||
const string pattern)
|
||||
{
|
||||
list<string> res;
|
||||
glob_t mglob;
|
||||
@@ -356,7 +356,7 @@ bool path_isdir(const string& path)
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string url_encode(const std::string url, string::size_type offs)
|
||||
string url_encode(const string& url, string::size_type offs)
|
||||
{
|
||||
string out = url.substr(0, offs);
|
||||
const char *cp = url.c_str();
|
||||
@@ -392,6 +392,26 @@ std::string url_encode(const std::string url, string::size_type offs)
|
||||
return out;
|
||||
}
|
||||
|
||||
string url_gpath(const string& url)
|
||||
{
|
||||
// Remove the access schema part (or whatever it's called)
|
||||
string::size_type colon = url.find_first_of(":");
|
||||
if (colon == string::npos || colon == url.size() - 1)
|
||||
return url;
|
||||
// If there are non-alphanum chars before the ':', then there
|
||||
// probably is no scheme. Whatever...
|
||||
for (string::size_type i = 0; i < colon; i++) {
|
||||
if (!isalnum(url.at(i)))
|
||||
return url;
|
||||
}
|
||||
|
||||
// In addition we canonize the path to remove empty host parts
|
||||
// (for compatibility with older versions of recoll where file://
|
||||
// was hardcoded, but the local path was used for doc
|
||||
// identification.
|
||||
return path_canon(url.substr(colon+1));
|
||||
}
|
||||
|
||||
// Printable url: this is used to transcode from the system charset
|
||||
// into either utf-8 if transcoding succeeds, or url-encoded
|
||||
bool printableUrl(const string &fcharset, const string &in, string &out)
|
||||
|
||||
+6
-1
@@ -50,11 +50,16 @@ extern string path_canon(const string &s);
|
||||
extern list<string> path_dirglob(const string &dir,
|
||||
const string pattern);
|
||||
/// Encode according to rfc 1738
|
||||
extern string url_encode(const string url,
|
||||
extern string url_encode(const string& url,
|
||||
string::size_type offs = 0);
|
||||
/// Transcode to utf-8 if possible or url encoding, for display.
|
||||
extern bool printableUrl(const string &fcharset,
|
||||
const string &in, string &out);
|
||||
|
||||
/// Return the host+path part of an url. This is not a general
|
||||
/// routine, it does the right thing only in the recoll context
|
||||
extern string url_gpath(const string& url);
|
||||
|
||||
/// Stat parameter and check if it's a directory
|
||||
extern bool path_isdir(const string& path);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user