GUI: add "Open With" entry in reslist/table popups to let the user choose the app

This commit is contained in:
Jean-Francois Dockes
2014-05-01 09:28:46 +02:00
parent b0b372e350
commit c897a09cd3
10 changed files with 104 additions and 12 deletions
+2 -1
View File
@@ -24,6 +24,7 @@
* code which would parse /usr/share/applications to return a list of
* apps for a given mime type. So here goes. Note that the implementation
* is very primitive for now (no use of cache file, no updating once built).
* Also, this is not thread-safe, but could be made so quite easily.
*/
class DesktopDb {
public:
@@ -49,7 +50,7 @@ public:
* problem was detected.
*/
bool appForMime(const std::string& mime, vector<AppDef> *apps,
std::string *reason);
std::string *reason = 0);
private:
DesktopDb();
+4 -4
View File
@@ -534,7 +534,7 @@ string escapeShell(const string &in)
// Substitute printf-like percent cmds inside a string
bool pcSubst(const string& in, string& out, map<char, string>& subs)
bool pcSubst(const string& in, string& out, const map<char, string>& subs)
{
string::const_iterator it;
for (it = in.begin(); it != in.end();it++) {
@@ -547,7 +547,7 @@ bool pcSubst(const string& in, string& out, map<char, string>& subs)
out += '%';
continue;
}
map<char,string>::iterator tr;
map<char,string>::const_iterator tr;
if ((tr = subs.find(*it)) != subs.end()) {
out += tr->second;
} else {
@@ -561,7 +561,7 @@ bool pcSubst(const string& in, string& out, map<char, string>& subs)
return true;
}
bool pcSubst(const string& in, string& out, map<string, string>& subs)
bool pcSubst(const string& in, string& out, const map<string, string>& subs)
{
out.erase();
string::size_type i;
@@ -592,7 +592,7 @@ bool pcSubst(const string& in, string& out, map<string, string>& subs)
} else {
key = in[i];
}
map<string,string>::iterator tr;
map<string,string>::const_iterator tr;
if ((tr = subs.find(key)) != subs.end()) {
out += tr->second;
} else {
+2 -2
View File
@@ -143,9 +143,9 @@ string displayableBytes(off_t size);
string breakIntoLines(const string& in, unsigned int ll = 100,
unsigned int maxlines= 50);
/** Small utility to substitute printf-like percents cmds in a string */
bool pcSubst(const string& in, string& out, map<char, string>& subs);
bool pcSubst(const string& in, string& out, const map<char, string>& subs);
/** Substitute printf-like percents and also %(key) */
bool pcSubst(const string& in, string& out, map<string, string>& subs);
bool pcSubst(const string& in, string& out, const map<string, string>& subs);
/** Append system error message */
void catstrerror(string *reason, const char *what, int _errno);