Merge lp:~libertine-team/libertine-scope/filters-replace-settings into lp:libertine-scope
- filters-replace-settings
- Merge into devel
Status: | Merged |
---|---|
Approved by: | Larry Price |
Approved revision: | 79 |
Merged at revision: | 45 |
Proposed branch: | lp:~libertine-team/libertine-scope/filters-replace-settings |
Merge into: | lp:libertine-scope |
Diff against target: |
1010 lines (+515/-139) 18 files modified
.bzrignore (+1/-0) CMakeLists.txt (+9/-4) data/CMakeLists.txt (+6/-8) data/blacklist (+11/-0) data/libertine-scope-settings.ini.in (+0/-24) libertine-scope/CMakeLists.txt (+4/-1) libertine-scope/action.cpp (+105/-0) libertine-scope/action.h (+42/-0) libertine-scope/config.h.in (+26/-0) libertine-scope/preview.cpp (+16/-0) libertine-scope/query.cpp (+199/-26) libertine-scope/query.h (+9/-5) libertine-scope/scope.cpp (+63/-30) po/libertine-scope.pot (+1/-1) tests/TypedScopeFixture.h (+1/-0) tests/fake_container_json.h (+2/-2) tests/test_preview.cpp (+2/-1) tests/test_query.cpp (+18/-37) |
To merge this branch: | bzr merge lp:~libertine-team/libertine-scope/filters-replace-settings |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Larry Price | Approve | ||
Libertine CI Bot | continuous-integration | Approve | |
Christopher Townsend | Approve | ||
Stephen M. Webb (community) | Approve | ||
Review via email: mp+295732@code.launchpad.net |
Commit message
* Replace the scope settings approach to suppress display of apps with a scope filter based approach. This provides a blacklist file for permanent suppression and filters for user suppression.
* Provide a "Hidden X Apps" department for a place to store the apps hidden in the main scope view, so they can be unhidden later if desired.
Description of the change
Replace the scope settings approach to suppress display of apps with a scope filter based approach. This provides a
blacklist file for permanent supression and filters for user supression.
# Filters
A scope multiselect option filter (accessible from scope search magnifying glass icon) is created for each container.
* Title is "Exclude Apps: <container name>".
* Each app appears by name.
* Checking an app refreshes the scope with the app excluded.
* Blacklisted apps do not appear
# Blacklist apps:
* Blacklisted apps are completely supressed
* To blacklist an app, add it to data/blacklist file
* One app per line, leading "#" is a comment
* Line is: containerID/desktop (without the .desktop extension)
Example for two containers (puritine * testc):
puritine/
puritine/
puritine/
puritine/
puritine/yelp
testc/mb-
== ADDED THE FOLLOWING
Implement departments in order to provide persistent app hiding. Now, there are:
two departments:
* The default surfacing dept (title: "X Apps") is the same as
when there were no departments: It shows containers and their apps. Tap an
app and the preview now has a "Hide" button. Tapping that puts the (by fully
qualified name) app into the Hidden X Apps department.
* We now also have "Hidden X Apps" Department. This shows containers & apps for
all apps the user has hidden. Tap an app, the preview shows "Show" button.
* App hiding is persistent with hidden apps written to "hidden" file in scope
cache directory. As such, we now pass cache dir to query constructor.
Address MP (most) comments, notably:
* fix test_query.cpp's ignoresAnyBlack
adding a Query method to set the blacklist QStringList since at normal
runtime, this is set by reading a file in cache directory, which is not
present during testing. So now we read that file and set in Query constructor
and then, in the case of the test, set again via the method (set_blacklist())
- 46. By Kyle Nitzsche
-
Filter title uses contianer name (instead of container id)
- 47. By Kyle Nitzsche
-
merge latest trunk to pick up cmake-fixes MP final changes.
Kyle Nitzsche (knitzsche) wrote : | # |
one: odd about the test segfault. I fixed a test segfault with line 305 below. I will try to reproduce.
two: I'll check into this
Kyle Nitzsche (knitzsche) wrote : | # |
re one: building the click works (except for the install dir being wrong as discussed in previous MP), and tests pass. So it must be an issue with building the debian package.
Christopher Townsend (townsend) wrote : | # |
How are you building the click in such a way that the tests are run?
Christopher Townsend (townsend) wrote : | # |
Also of note is that I'm building this on an amd64 system.
- 48. By Kyle Nitzsche
-
* Reverted Query constructer signature:
* The query run() method needs the scope directory to get the blacklist file. I had previously passed that to the query on construction from the scope class. But this meant that some other cases where the query was constructed (tests) needed to be changed as well. So I reverted this, and the related changes in test_query.cpp in which I had created the Query with "fake" scope dir.
* Instead, the query now has set_scope_dir() method and scope_dir_ var. Scope now calls this, setting the scope dir in the query for its use.* Fixed googletest failures:
* TestQueryFixture's expect_registery() EXPECT_CALL expects that the register_category() arg three is "Application". I had set that an empty string (in query.cpp run()) because the third arg is for an icon, but this caused test failure, so it is back to "Application".
* This MP's new query.cpp app_keys(app.uri) method expects the uri when split on "/" to be four items in length (which is it at runtime). In testing though, it is not always that long. So I changed the method to simply return an empty map if the uri is too short, and this should not cause run time misbehavior. Related: in tests/fake_container_ json.h I made the uris longer, so, for example, instead of some/uri it is now some/uri/pad1/pad2. * New feature: blacklist from all containers:
* in data/blacklist file, use containerID of "all", like so: all/yelp
* Result: the yelp app is excluded from display in the scope, both as an app in results for all containers and in corresponding filters* New feature: added whitelist capabilities. If you have blacklisted an app from all containers, you can add it back to specified containers like so: whitelist/
containerID/ app Feature Example: In the following blacklsit file mp-panel-manager is blacklisted from all containers, but then added back (whitelisted) in testc container.
# containerIDqq/
desktop file name (without .desktop extension)
# use containerID "all" to blacklist app from all containers
# examples:
all/mb-panel-manager
puritine/openjdk- 7-java
puritine/openjdk- 7-policytool
puritine/debian- uxterm
# include apps per continaer that are blacklisted for "all" by prepending "whitelist/"
whitelist/testc/mb- panel-manager
testc/yelp
Christopher Townsend (townsend) wrote : | # |
Hey Kyle,
Could you please merge lp:libertine-scope to pick up the latest changes and fix the conflicts?
Thanks!
Libertine CI Bot (libertine-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:48
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
https:/
Executed test runs:
FAILURE: https:/
None: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
- 49. By Kyle Nitzsche
-
[ Chris Townsend ]
* Use the "unconfined" apparmor template to allow the scope to access user
data (lp: #1558738).
[ Larry Price ]
* Redesigned preview pane with reasonably-sized image, title, and description.
* Filtered app launchers based on a user-input regular expression.
* Added a setting for listing app launcher names which should be excluded
from the scope view.
[ Stephen M. Webb ]
* Added internationalization support.
[ CI Train Bot ]
* No-change rebuild.
[ Kyle Nitzsche ]
* bzr merge from trunk to pick up diverged bits
Libertine CI Bot (libertine-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:49
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
https:/
Executed test runs:
FAILURE: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Larry Price (larryprice) wrote : | # |
Works well! I've made a few diff comments below, but I still need to dive into the thick logic before I'm finished.
Christopher Townsend (townsend) wrote : | # |
Couple of inline comments as well.
Also, as Larry mentioned we shouldn't comment out the tests. Let's either fix them or just remove them.
Larry Price (larryprice) wrote : | # |
A few more minor inline comments.
- 50. By Kyle Nitzsche
-
interim commit towards revisions for MR
- 51. By Kyle Nitzsche
-
implement departments to:
* allow the user to Hide an app, in which case it no longer displays in
root dept, instead it displays in hidden dept.
* all the user to undo the hide (look at hidden department, tap a result,
tap the Show button - 52. By Kyle Nitzsche
-
add activate.h and activate.cpp
- 53. By Kyle Nitzsche
-
Implement departments in order to provide persistent app hiding. Now, there are:
two departments:
* The default surfacing dept (title: "X Apps") is the same as
when there were no departments: It shows containers and their apps. Tap an
app and the preview now has a "Hide" button. Tapping that puts the (by fully
qualified name) app into the Hidden X Apps department.
* We now also have "Hidden X Apps" Department. This shows containers & apps for
all apps the user has hidden. Tap an app, the preview shows "Show" button.
* App hiding is persistent with hidden apps written to "hidden" file in scope
cache directory. As such, we now pass cache dir to query constructor.Address MP (most) comments, notably:
* fix test_query.cpp's ignoresAnyBlacklistedApps test. Note: this required
adding a Query method to set the blacklist QStringList since at normal
runtime, this is set by reading a file in cache directory, which is not
present during testing. So now we read that file and set in Query constructor
and then, in the case of the test, set again via the method (set_blacklist()) - 54. By Kyle Nitzsche
-
delete debug msg in libertine-
scope/CMakeList s.txt - 55. By Kyle Nitzsche
-
fix typo in data/blacklist
- 56. By Kyle Nitzsche
-
typo fix
Libertine CI Bot (libertine-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:56
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Christopher Townsend (townsend) wrote : | # |
Thanks! Just a very quick first pass- please see inline comments.
I'll build this and try it out soon as well as review the meat of code some more.
- 57. By Kyle Nitzsche
-
* cmake project ver: 1.2
* revert cmake dirs to not break debian build, and leave cmake variant for
building clicks in but commented out - 58. By Kyle Nitzsche
-
complete change of scope FQ name to use "ubuntu" in cpp files.
Libertine CI Bot (libertine-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:58
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Larry Price (larryprice) wrote : | # |
i made some syntax comments below, i'll try to check out the functionality and details later.
also, you should set the Commit Message so that CI is fixed.
- 59. By Kyle Nitzsche
-
if an app is hidden, do not display it in filters
Libertine CI Bot (libertine-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:59
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Stephen M. Webb (bregma) wrote : | # |
See inline comments. Make sure the formatting is consistent with the rest of the project code.
- 60. By Kyle Nitzsche
-
use project style in action.cpp and remove two unused functions (qstr and sstr)
- 61. By Kyle Nitzsche
-
use out(QTextStream) instead of out << std::endl;
- 62. By Kyle Nitzsche
-
address mp comments
- 63. By Kyle Nitzsche
-
address mp comments on scope.cpp
- 64. By Kyle Nitzsche
-
per mp comment, make destructor virtual
- 65. By Kyle Nitzsche
-
address mp comments in query.cpp and query.h except for the bit about
dropping set_blacklist(), which will be committed separately. - 66. By Kyle Nitzsche
-
fix blacklist file yelp whitelist example (commented out)
- 67. By Kyle Nitzsche
-
first commit of addressing mp request to drop Query's public set_blacklist()
and instead pass the pair of b/w lists to query constructor. This part works,
that is, the scope works. But the test_query.cpp ignoresAnyBlacklistedApps
has not yet been fixed and is here commented out. - 68. By Kyle Nitzsche
-
add libertine-
scope/config. h.in file to pick up subs vars from root CMakeLists.txt
and add other const vars.generate config.h via cmake
bzr ignore generated libertine-
scope/config. h - 69. By Kyle Nitzsche
-
address another set of MP comments around style issue and tuple&tie vs
pair - 70. By Kyle Nitzsche
-
one final MP comment fix.
Kyle Nitzsche (knitzsche) wrote : | # |
On 06/07/2016 02:09 PM, Stephen M. Webb wrote:
> Review: Needs Fixing
>
> See inline comments. Make sure the formatting is consistent with the rest of the project code.
>
> Diff comments:
>
>>
>> === added file 'libertine-
>> --- libertine-
>> +++ libertine-
>> @@ -0,0 +1,87 @@
>> +/*
>> + * Copyright (C) 2016 Canonical Ltd
>> + *
>> + * This program is free software: you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 3 as
>> + * published by the Free Software Foundation.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>> + * GNU General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU General Public License
>> + * along with this program. If not, see <http://
>> + * * Authored by:
>> + * Kyle Nitzsche <email address hidden>
>> + */
>> +
>> +#include <action.h>
>
> #include "libertine-
of course! :)
>
>> +#include <unity/
>> +#include <unity/
>> +#include <url-dispatcher.h>
>> +#include <QString>
>> +#include <QFile>
>> +#include <QTextStream>
>> +
>> +namespace usc = unity::scopes;
>> +using namespace std;
>
> Is there a point to this if all the ats:: names are fully qualified?
copy paste error. removed.
>
>> +
>> +extern QString qstr(const std::string &s);
>> +extern std::string sstr(const QString &qstring);
>> +
>> +Action:
>
> ctor name should be aligned left
done
>
>> + const usc::ActionMetadata &metadata,
>> + const std::string &action_id,
>> + const std::string &cache_dir)
>
> should be type const& not const type &
>
fixed
>> + : usc::Activation
>> + action_
>> + cache_dir_
>> +}
>> +
>> +usc::Activatio
>
> newline before { and function name aligned left
Got it!
>
>> +
>> + if (action_id_ == "open"){
>
> newline before {
yes
>
>> + url_dispatch_
>> + return usc::Activation
>> + } else if (action_id_ == "hide"){
>
> newlines
fixed
>
>> + QFile file(QString(
>> + file.open(
>> + QTextStream out(&file);
>> + out << QString:
>> + file.flush();
>> + file.close();
>> + usc::CannedQuery cq("libertine-
>
> Isn't that scope-id string available as a defined constant somewhere?
Not here. I would have to pass it in constructor.
Instead, I've implemented an approach we've used a lot: get the scope
FQN (PKG_APP) from a new header file (config.h.in > config.h) whose vars
de...
Libertine CI Bot (libertine-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:69
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Libertine CI Bot (libertine-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:70
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
- 71. By Kyle Nitzsche
-
update the pot file
Libertine CI Bot (libertine-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:71
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
- 72. By Kyle Nitzsche
-
found another instance of pair and changed to tuple per MP
comment
Libertine CI Bot (libertine-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:72
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Stephen M. Webb (bregma) wrote : | # |
Got a few inline comments again.
Kyle Nitzsche (knitzsche) wrote : | # |
Addressed all points. click works fine. comments inline. will soon MP
branch after ensuring gtests still pass.
thx.
On 06/08/2016 10:18 AM, Stephen M. Webb wrote:
> Review: Needs Fixing
>
> Got a few inline comments again.
>
> Diff comments:
>
>>
>> === added file 'libertine-
>> --- libertine-
>> +++ libertine-
>> @@ -0,0 +1,96 @@
>> +/*
>> + * Copyright (C) 2016 Canonical Ltd
>> + *
>> + * This program is free software: you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 3 as
>> + * published by the Free Software Foundation.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>> + * GNU General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU General Public License
>> + * along with this program. If not, see <http://
>> + * * Authored by:
>> + * Kyle Nitzsche <email address hidden>
>> + */
>> +
>> +#include "libertine-
>> +#include "libertine-
>> +#include <unity/
>> +#include <unity/
>> +#include <url-dispatcher.h>
>> +#include <QString>
>> +#include <QFile>
>> +#include <QTextStream>
>> +
>> +namespace usc = unity::scopes;
>> +
>> +Action::
>> +Action(const usc::Result &result,
>> + usc::ActionMetadata const& metadata,
>> + std::string const& action_id,
>> + std::string const &cache_dir)
>> + : usc::Activation
>> + action_
>> + cache_dir_
>
> newline before {
fixed
>
>> +}
>> +
>> +usc::Activatio
>> +Action::activate()
>> +{
>> +
>> + if (action_id_ == "open")
>> + {
>> + url_dispatch_
>> + return usc::Activation
>> + }
>> + else if (action_id_ == "hide")
>> + {
>> + QFile file(QString(
>> + file.open(
>> + QTextStream out(&file);
>> + out << QString:
>> + endl(out);
>> + file.close();
>> + usc::CannedQuery cq(SCOPE_PKG + "_" + SCOPE_APP);
>> + cq.set_
>> + return usc::Activation
>> + }
>> + else if (action_id_ == "show")
>> + {
>> + QStringList hidden;
>> + QFile hidden_
>> + if (hidden_f.exists()) {
>> + QStringList hidden;
>> + if (hidden_
>> + {
>> + QTextStream in(&hidden_f);
>> + while (!in.atEnd())
>> + {
>> + QString line(in.
>> + hidden.
>> + }
>> + hidden_f.close();
>> + }
>...
- 73. By Kyle Nitzsche
-
address another set of MP comments
Stephen M. Webb (bregma) wrote : | # |
OK, good enough for me.
Libertine CI Bot (libertine-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:73
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Larry Price (larryprice) wrote : | # |
Submitted another round of comments. We're getting close.
- 74. By Kyle Nitzsche
-
addressed another batch of MP comments.
The only one I did not address is adding a test for whitelisting. I tried,
it does not work, yet whitelisting itself does work. I have not yet seen
what the issue is. here's the test: https://pastebin. canonical. com/158344/
Libertine CI Bot (libertine-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:74
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Kyle Nitzsche (knitzsche) wrote : | # |
On 06/08/2016 12:23 PM, Larry Price wrote:
> Review: Needs Fixing
>
> Submitted another round of comments. We're getting close.
>
> Diff comments:
>
>>
>> === added file 'libertine-
>> --- libertine-
>> +++ libertine-
>> @@ -0,0 +1,95 @@
>> +/*
>> + * Copyright (C) 2016 Canonical Ltd
>> + *
>> + * This program is free software: you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 3 as
>> + * published by the Free Software Foundation.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>> + * GNU General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU General Public License
>> + * along with this program. If not, see <http://
>> + * * Authored by:
>> + * Kyle Nitzsche <email address hidden>
>> + */
>> +
>> +#include "libertine-
>> +#include "libertine-
>> +#include <unity/
>> +#include <unity/
>> +#include <url-dispatcher.h>
>> +#include <QString>
>> +#include <QFile>
>> +#include <QTextStream>
>> +
>> +namespace usc = unity::scopes;
>> +
>> +Action::
>> +Action(const usc::Result &result,
>> + usc::ActionMetadata const& metadata,
>
> the spacing on this parameter list should be lined up, which would also mean moving const to the other side of usc::Result to match the other params
done
>
>> + std::string const& action_id,
>> + std::string const &cache_dir)
>> + : usc::Activation
>> + action_
>> + cache_dir_
>> +{
>> +}
>> +
>> +usc::Activatio
>> +Action::activate()
>> +{
>> +
>
> delete
done
>
>> + if (action_id_ == "open")
>> + {
>> + url_dispatch_
>> + return usc::Activation
>> + }
>> + else if (action_id_ == "hide")
>> + {
>> + QFile file(QString(
>> + file.open(
>> + QTextStream out(&file);
>> + out << QString:
>> + endl(out);
>> + file.close();
>> + usc::CannedQuery cq(SCOPE_PKG + "_" + SCOPE_APP);
>> + return usc::Activation
>> + }
>> + else if (action_id_ == "show")
>
> this method is a bit long for me - extends more than 1 screen of my laptop. could you extract some of this logic to another function?
done.
>
>> + {
>> + QStringList hidden;
>
> unused variable - delete
right - deleted
>
>> + QFile hidden_
>> + if (hidden_f.exists()) {
>> + QStringList hidden;
>> + if (hidden_
>> + {
>> + QTextStream in...
Larry Price (larryprice) wrote : | # |
I've included some quick inline comments.
In regards to the test you mentioned in the pastebin (https:/
Christopher Townsend (townsend) wrote : | # |
Ok, I'm good with this. +1
Thanks!
- 75. By Kyle Nitzsche
-
addressed another set of MP comments.
- 76. By Kyle Nitzsche
-
move make_departments() and make_filters() to anon namespace as static
- 77. By Kyle Nitzsche
-
revert accidental commit of click centric CMakeLists.txt
Libertine CI Bot (libertine-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:75
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
- 78. By Kyle Nitzsche
-
remove errant qDebug() statement
Libertine CI Bot (libertine-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:78
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
- 79. By Kyle Nitzsche
-
add displayWhitelis
tedApps test_query.cpp test.
Kyle Nitzsche (knitzsche) wrote : | # |
On 06/08/2016 02:04 PM, Larry Price wrote:
> Review: Needs Fixing
>
> I've included some quick inline comments.
>
> In regards to the test you mentioned in the pastebin (https:/
>
whitelisting only applies to apps that were blacklisted.
> Diff comments:
>
>>
>> === modified file 'libertine-
>> --- libertine-
>> +++ libertine-
>> @@ -57,6 +57,21 @@
>> {"id", usc::Variant(
>> {"label", usc::Variant(
>> });
>> + if (result(
>
> should this be ROOT_DEPT_ID?
yes -thx
>
>> + {
>> + vb.add_tuple({
>> + {"id", usc::Variant(
>> + {"label", usc::Variant(
>> + });
>> + }
>> + else
>> + { //is hidden department
>> + vb.add_tuple({
>> + {"id", usc::Variant(
>> + //Translators: Users tap "Show" button to remove an app from the hidden lis of apps: so the meaning is to undo a hide
>> + {"label", usc::Variant(
>> + });
>> + }
>> buttons.
>>
>> usc::PreviewWidget desc("desc", "text");
>>
>> === modified file 'libertine-
>> --- libertine-
>> +++ libertine-
>> @@ -71,59 +120,140 @@
>> {
>> }
>>
>> -
>> unity::
>> Query::settings() const
>> {
>> return SearchQueryBase
>> }
>>
>> -
>> -QStringList
>> -Query::blacklist() const
>> -{
>> - QStringList blacklistedApps;
>> - auto blacklist = settings(
>> - if (!blacklist.
>> - blacklistedApps = QString:
>> - .remove("\"")
>> - .split(";", QString:
>> - }
>> - return blacklistedApps;
>> -}
>> -
>> -
>> void Query::
>> run(usc:
>> {
>> - auto blacklistedApps = blacklist();
>> + auto hidden = get_hidden(
>> + // make scope departments
>
> This function is really long to try to take in all at once. A lot of these places where there is a comment could be made into a well-named function.
done. added make_departments() and make_filters()
>
>> + if (hidden.size() > 0 )
>> + {
>> + usc::Department
>> + usc::Department
>> + usc::CannedQuery myquery(
>> + myquery.
>> + root_dept = std::move(
>> + myquery.
>> + hidden_apps_dept = std::move(
>> + root_dept-
>> + reply->
>> + }
>> +
>> + std::pair<
>> + std::map<
Libertine CI Bot (libertine-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:79
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Larry Price (larryprice) wrote : | # |
OK, let's get this merged for now.
Preview Diff
1 | === modified file '.bzrignore' |
2 | --- .bzrignore 2016-02-29 18:49:55 +0000 |
3 | +++ .bzrignore 2016-06-08 19:55:17 +0000 |
4 | @@ -1,2 +1,3 @@ |
5 | po/POTFILES.in |
6 | po/Makefile.in.in |
7 | +config.h |
8 | |
9 | === modified file 'CMakeLists.txt' |
10 | --- CMakeLists.txt 2016-06-01 20:28:54 +0000 |
11 | +++ CMakeLists.txt 2016-06-08 19:55:17 +0000 |
12 | @@ -46,7 +46,10 @@ |
13 | set(APP ${PROJECT}) |
14 | |
15 | # Important project paths |
16 | +# Use this SCOPE_INSTALL_DIR when building the debian |
17 | set(SCOPE_INSTALL_DIR ${CMAKE_INSTALL_FULL_LIBDIR}/unity-scopes/libertine-scope/) |
18 | +# USE this when building the click |
19 | +#set(SCOPE_INSTALL_DIR "/libertine-scope") |
20 | set(SCOPE_NAME "libertine-scope") |
21 | set(GETTEXT_PACKAGE "${SCOPE_NAME}") |
22 | |
23 | @@ -63,10 +66,12 @@ |
24 | |
25 | # Configure and install the click manifest and apparmor files |
26 | configure_file(manifest.json.in ${CMAKE_CURRENT_BINARY_DIR}/manifest.json) |
27 | -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.json |
28 | - DESTINATION ${SCOPE_INSTALL_DIR}) |
29 | -install(FILES "libertine-scope.apparmor" |
30 | - DESTINATION ${SCOPE_INSTALL_DIR}) |
31 | +install(FILES |
32 | + ${CMAKE_CURRENT_BINARY_DIR}/manifest.json |
33 | + "libertine-scope.apparmor" |
34 | + DESTINATION ${SCOPE_INSTALL_DIR}) |
35 | +#Use this DESTINATION when building click |
36 | +# DESTINATION "/") |
37 | |
38 | # Add our main directories |
39 | add_subdirectory(libertine-scope) |
40 | |
41 | === modified file 'data/CMakeLists.txt' |
42 | --- data/CMakeLists.txt 2016-06-02 16:56:29 +0000 |
43 | +++ data/CMakeLists.txt 2016-06-08 19:55:17 +0000 |
44 | @@ -7,18 +7,11 @@ |
45 | ALL |
46 | UTF8 |
47 | ) |
48 | -intltool_merge_translations( |
49 | - "libertine-scope-settings.ini.in" |
50 | - "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}_${SCOPE_NAME}-settings.ini" |
51 | - ALL |
52 | - UTF8 |
53 | -) |
54 | |
55 | # Install the scope ini files |
56 | install( |
57 | FILES |
58 | "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}_${SCOPE_NAME}.ini" |
59 | - "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}_${SCOPE_NAME}-settings.ini" |
60 | DESTINATION |
61 | ${SCOPE_INSTALL_DIR} |
62 | ) |
63 | @@ -31,4 +24,9 @@ |
64 | ${SCOPE_INSTALL_DIR} |
65 | ) |
66 | |
67 | - |
68 | +install( |
69 | + FILES |
70 | + "blacklist" |
71 | + DESTINATION |
72 | + ${SCOPE_INSTALL_DIR} |
73 | +) |
74 | |
75 | === added file 'data/blacklist' |
76 | --- data/blacklist 1970-01-01 00:00:00 +0000 |
77 | +++ data/blacklist 2016-06-08 19:55:17 +0000 |
78 | @@ -0,0 +1,11 @@ |
79 | +# containerID/desktop file name (without .desktop extension) |
80 | +# use containerID "all" to blacklist app from all containers |
81 | +# examples: |
82 | +all/mb-panel-manager |
83 | +all/openjdk-7-java |
84 | +all/openjdk-7-policytool |
85 | +all/debian-uxterm |
86 | +all/yelp |
87 | +# include apps per container that are blacklisted for "all" by prepending "whitelist/" |
88 | +#whitelist/testc/yelp |
89 | +#whitelist/testc/mb-panel-manager |
90 | |
91 | === removed file 'data/libertine-scope-settings.ini.in' |
92 | --- data/libertine-scope-settings.ini.in 2016-04-21 16:25:00 +0000 |
93 | +++ data/libertine-scope-settings.ini.in 1970-01-01 00:00:00 +0000 |
94 | @@ -1,24 +0,0 @@ |
95 | -[blacklist] |
96 | -type = string |
97 | -_displayName = Excluded Apps |
98 | -defaultValue = Panel Manager;OpenJDK Java 7 Policy Tool;OpenJDK Java 8 Policy Tool; |
99 | - |
100 | -# Below are some example settings. You can access your scope's |
101 | -# settings by calling settings() from the Query::run() method. |
102 | -# E.g. auto location = settings().at("location").get_string(); |
103 | - |
104 | -#[location] |
105 | -#type = string |
106 | -#defaultValue = London,uk |
107 | -#_displayName = Default Location |
108 | - |
109 | -#[units] |
110 | -#type = list |
111 | -#_displayName = Temperature Units |
112 | -#_displayValues = Metric;Imperial |
113 | -#defaultValue = 0 |
114 | - |
115 | -#[forecast] |
116 | -#type = boolean |
117 | -#defaultValue = true |
118 | -#_displayName = Show Forecast |
119 | |
120 | === modified file 'libertine-scope/CMakeLists.txt' |
121 | --- libertine-scope/CMakeLists.txt 2016-05-20 20:55:47 +0000 |
122 | +++ libertine-scope/CMakeLists.txt 2016-06-08 19:55:17 +0000 |
123 | @@ -24,12 +24,15 @@ |
124 | ${URL_DISPATCHER_LIBRARIES} |
125 | ) |
126 | |
127 | +configure_file( |
128 | + "${CMAKE_CURRENT_SOURCE_DIR}/config.h.in" |
129 | + "${CMAKE_CURRENT_SOURCE_DIR}/config.h" |
130 | +) |
131 | |
132 | set_target_properties(scope |
133 | PROPERTIES |
134 | OUTPUT_NAME "${PACKAGE_NAME}_${SCOPE_NAME}" |
135 | ) |
136 | - |
137 | install(TARGETS scope |
138 | LIBRARY DESTINATION ${SCOPE_INSTALL_DIR} |
139 | ) |
140 | |
141 | === added file 'libertine-scope/action.cpp' |
142 | --- libertine-scope/action.cpp 1970-01-01 00:00:00 +0000 |
143 | +++ libertine-scope/action.cpp 2016-06-08 19:55:17 +0000 |
144 | @@ -0,0 +1,105 @@ |
145 | +/* |
146 | + * Copyright (C) 2016 Canonical Ltd |
147 | + * |
148 | + * This program is free software: you can redistribute it and/or modify |
149 | + * it under the terms of the GNU General Public License version 3 as |
150 | + * published by the Free Software Foundation. |
151 | + * |
152 | + * This program is distributed in the hope that it will be useful, |
153 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
154 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
155 | + * GNU General Public License for more details. |
156 | + * |
157 | + * You should have received a copy of the GNU General Public License |
158 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
159 | + * * Authored by: |
160 | + * Kyle Nitzsche <kyle.nitzsche@canonical.com> |
161 | + */ |
162 | + |
163 | +#include "libertine-scope/action.h" |
164 | +#include "libertine-scope/config.h" |
165 | +#include <unity/scopes/ActivationResponse.h> |
166 | +#include <unity/scopes/CannedQuery.h> |
167 | +#include <url-dispatcher.h> |
168 | +#include <QString> |
169 | +#include <QFile> |
170 | +#include <QTextStream> |
171 | + |
172 | +namespace usc = unity::scopes; |
173 | + |
174 | +namespace |
175 | +{ |
176 | + |
177 | +static void |
178 | +write_apps_to_hidden(QFile &hidden_f, QStringList const& hidden) |
179 | +{ |
180 | + hidden_f.open(QIODevice::WriteOnly | QIODevice::Text); |
181 | + QTextStream out(&hidden_f); |
182 | + for (auto const& app : hidden) |
183 | + { |
184 | + out << app << "\n"; |
185 | + } |
186 | + hidden_f.flush(); |
187 | + hidden_f.close(); |
188 | +} |
189 | + |
190 | +} //anonymous namespace |
191 | + |
192 | + |
193 | +Action:: |
194 | +Action(usc::Result const& result, |
195 | + usc::ActionMetadata const& metadata, |
196 | + std::string const& action_id, |
197 | + std::string const& cache_dir) |
198 | + : usc::ActivationQueryBase(result, metadata), |
199 | + action_id_(action_id), |
200 | + cache_dir_(cache_dir) |
201 | +{ |
202 | +} |
203 | + |
204 | +usc::ActivationResponse |
205 | +Action::activate() |
206 | +{ |
207 | + if (action_id_ == "open") |
208 | + { |
209 | + url_dispatch_send(result().uri().c_str() , NULL, NULL); |
210 | + return usc::ActivationResponse(usc::ActivationResponse::Status::NotHandled); |
211 | + } |
212 | + else if (action_id_ == "hide") |
213 | + { |
214 | + QFile file(QString("%1/%2").arg(QString::fromStdString(cache_dir_),"hidden")); |
215 | + file.open(QIODevice::Append | QIODevice::Text); |
216 | + QTextStream out(&file); |
217 | + out << QString::fromStdString(result()["app_id"].get_string()); |
218 | + endl(out); |
219 | + file.close(); |
220 | + usc::CannedQuery cq(SCOPE_PKG + "_" + SCOPE_APP); |
221 | + return usc::ActivationResponse(cq); |
222 | + } |
223 | + else if (action_id_ == "show") |
224 | + { |
225 | + QFile hidden_f(QString("%1/%2").arg(QString::fromStdString(cache_dir_), QString::fromStdString("hidden"))); |
226 | + if (hidden_f.exists()) { |
227 | + QStringList hidden; |
228 | + if (hidden_f.open(QIODevice::ReadOnly | QIODevice::Text)) |
229 | + { |
230 | + QTextStream in(&hidden_f); |
231 | + while (!in.atEnd()) |
232 | + { |
233 | + QString line(in.readLine()); |
234 | + hidden.append(line.trimmed()); |
235 | + } |
236 | + hidden_f.close(); |
237 | + } |
238 | + QString app_id = QString::fromStdString(result()["app_id"].get_string()); |
239 | + if (hidden.contains(app_id)) |
240 | + { |
241 | + hidden.removeAll(app_id); |
242 | + write_apps_to_hidden(hidden_f, hidden); |
243 | + } |
244 | + } |
245 | + usc::CannedQuery cq(SCOPE_PKG + "_" + SCOPE_APP); |
246 | + return usc::ActivationResponse(cq); |
247 | + } |
248 | + return usc::ActivationResponse(usc::ActivationResponse::Status::NotHandled); |
249 | +} |
250 | |
251 | === added file 'libertine-scope/action.h' |
252 | --- libertine-scope/action.h 1970-01-01 00:00:00 +0000 |
253 | +++ libertine-scope/action.h 2016-06-08 19:55:17 +0000 |
254 | @@ -0,0 +1,42 @@ |
255 | +/* |
256 | + * Copyright (C) 2016 Canonical Ltd |
257 | + * |
258 | + * This program is free software: you can redistribute it and/or modify |
259 | + * it under the terms of the GNU General Public License version 3 as |
260 | + * published by the Free Software Foundation. |
261 | + * |
262 | + * This program is distributed in the hope that it will be useful, |
263 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
264 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
265 | + * GNU General Public License for more details. |
266 | + * |
267 | + * You should have received a copy of the GNU General Public License |
268 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
269 | + * * Authored by: |
270 | + * Kyle Nitzsche <kyle.nitzsche@canonical.com> |
271 | + */ |
272 | + |
273 | +#ifndef SCOPE_ACTION_H_ |
274 | +#define SCOPE_ACTION_H_ |
275 | + |
276 | +#include "libertine-scope/scope.h" |
277 | +#include <unity/scopes/ActionMetadata.h> |
278 | +#include <unity/scopes/ActivationQueryBase.h> |
279 | +#include <unity/scopes/ActivationResponse.h> |
280 | +#include <unity/scopes/Result.h> |
281 | + |
282 | +class Action : public unity::scopes::ActivationQueryBase { |
283 | + public: |
284 | + Action(unity::scopes::Result const& result, |
285 | + unity::scopes::ActionMetadata const& metadata, |
286 | + std::string const& action_id, |
287 | + std::string const& cache_dir); |
288 | + |
289 | + virtual ~Action() = default; |
290 | + virtual unity::scopes::ActivationResponse activate() override; |
291 | + |
292 | + private: |
293 | + std::string action_id_; |
294 | + std::string cache_dir_; |
295 | +}; |
296 | +#endif |
297 | |
298 | === added file 'libertine-scope/config.h.in' |
299 | --- libertine-scope/config.h.in 1970-01-01 00:00:00 +0000 |
300 | +++ libertine-scope/config.h.in 2016-06-08 19:55:17 +0000 |
301 | @@ -0,0 +1,26 @@ |
302 | +/* |
303 | + * Copyright 2015-2016 Canonical Ltd. |
304 | + * |
305 | + * This program is free software: you can redistribute it and/or modify it under |
306 | + * the terms of the GNU General Public License, version 3, as published by the |
307 | + * Free Software Foundation. |
308 | + * |
309 | + * This program is distributed in the hope that it will be useful, |
310 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
311 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
312 | + * GNU General Public License for more details. |
313 | + * |
314 | + * You should have received a copy of the GNU General Public License |
315 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
316 | + */ |
317 | +#ifndef LIBERTINE_SCOPE_CONFIG_H_ |
318 | +#define LIBERTINE_SCOPE_CONFIG_H_ |
319 | + |
320 | +const std::string SCOPE_PKG = "@PACKAGE_NAME@"; |
321 | +const std::string SCOPE_APP = "@SCOPE_NAME@"; |
322 | +const std::string ROOT_DEPT_ID = "root_dept"; |
323 | +const std::string HIDDEN_DEPT_ID = "hidden_dept"; |
324 | + |
325 | +#endif // LIBERTINE_SCOPE_CONFIG_H_ |
326 | + |
327 | + |
328 | |
329 | === modified file 'libertine-scope/preview.cpp' |
330 | --- libertine-scope/preview.cpp 2016-05-03 13:25:14 +0000 |
331 | +++ libertine-scope/preview.cpp 2016-06-08 19:55:17 +0000 |
332 | @@ -15,6 +15,7 @@ |
333 | */ |
334 | |
335 | #include "libertine-scope/preview.h" |
336 | +#include "libertine-scope/config.h" |
337 | #include <unity/scopes/PreviewReply.h> |
338 | #include <unity/scopes/Variant.h> |
339 | #include <unity/scopes/VariantBuilder.h> |
340 | @@ -57,6 +58,21 @@ |
341 | {"id", usc::Variant("open")}, |
342 | {"label", usc::Variant("Open")}, |
343 | }); |
344 | + if (result()["department_id"].get_string() == ROOT_DEPT_ID) |
345 | + { |
346 | + vb.add_tuple({ |
347 | + {"id", usc::Variant("hide")}, |
348 | + {"label", usc::Variant("Hide")}, |
349 | + }); |
350 | + } |
351 | + else |
352 | + { //is hidden department |
353 | + vb.add_tuple({ |
354 | + {"id", usc::Variant("show")}, |
355 | + //Translators: Users tap "Show" button to remove an app from the hidden lis of apps: so the meaning is to undo a hide |
356 | + {"label", usc::Variant("Show")}, |
357 | + }); |
358 | + } |
359 | buttons.add_attribute_value("actions", vb.end()); |
360 | |
361 | usc::PreviewWidget desc("desc", "text"); |
362 | |
363 | === modified file 'libertine-scope/query.cpp' |
364 | --- libertine-scope/query.cpp 2016-05-04 17:56:13 +0000 |
365 | +++ libertine-scope/query.cpp 2016-06-08 19:55:17 +0000 |
366 | @@ -16,21 +16,137 @@ |
367 | |
368 | #include "libertine-scope/query.h" |
369 | #include "libertine-scope/container.h" |
370 | +#include "libertine-scope/config.h" |
371 | +#include "localization.h" |
372 | #include <unity/scopes/CategorisedResult.h> |
373 | #include <unity/scopes/CategoryRenderer.h> |
374 | #include <unity/scopes/QueryBase.h> |
375 | #include <unity/scopes/SearchReply.h> |
376 | +#include <unity/scopes/Department.h> |
377 | +#include <unity/scopes/OptionSelectorFilter.h> |
378 | +#include <unity/scopes/FilterOption.h> |
379 | #include <QString> |
380 | #include <QStringList> |
381 | #include <QRegExp> |
382 | - |
383 | +#include <QFile> |
384 | +#include <QDebug> |
385 | +#include <QTextStream> |
386 | |
387 | namespace usc = unity::scopes; |
388 | |
389 | - |
390 | namespace |
391 | { |
392 | |
393 | +//returns map of apps with keys: container, app, name |
394 | +static std::map<QString,QString> |
395 | +app_keys(std::string const& uri) |
396 | +{ |
397 | + std::map<QString,QString> parts; |
398 | + QStringList uri_parts = QString::fromStdString(uri).split("/"); |
399 | + if (uri_parts.size() < 4) |
400 | + { |
401 | + return parts; |
402 | + } |
403 | + parts["container"] = uri_parts[2]; |
404 | + parts["name"] = uri_parts[3]; |
405 | + parts["key"] = QString("%1/%2").arg(parts["container"],parts["name"]); |
406 | + return parts; |
407 | +} |
408 | + |
409 | +static QStringList |
410 | +get_hidden(std::string const& cache_dir) |
411 | +{ |
412 | + QStringList hidden; |
413 | + QFile hidden_f(QString("%1/%2").arg(QString::fromStdString(cache_dir), QString::fromStdString("hidden"))); |
414 | + if (hidden_f.exists()) |
415 | + { |
416 | + if (hidden_f.open(QIODevice::ReadOnly | QIODevice::Text)) |
417 | + { |
418 | + QTextStream in(&hidden_f); |
419 | + while (!in.atEnd()) |
420 | + { |
421 | + QString line(in.readLine()); |
422 | + hidden.append(line.trimmed()); |
423 | + } |
424 | + hidden_f.close(); |
425 | + } |
426 | + } |
427 | + return hidden; |
428 | +} |
429 | + |
430 | +static void |
431 | +make_departments(usc::SearchReplyProxy const& reply) |
432 | +{ |
433 | + usc::Department::SPtr root_dept; |
434 | + usc::Department::SPtr hidden_apps_dept; |
435 | + usc::CannedQuery myquery("libertine-scope.ubuntu"); |
436 | + myquery.set_department_id(ROOT_DEPT_ID); |
437 | + root_dept = std::move(usc::Department::create("", myquery, _("X Apps"))); |
438 | + myquery.set_department_id(HIDDEN_DEPT_ID); |
439 | + hidden_apps_dept = std::move(usc::Department::create("hidden", myquery, _("Hidden X Apps"))); |
440 | + root_dept->add_subdepartment(hidden_apps_dept); |
441 | + reply->register_departments(root_dept); |
442 | +} |
443 | + |
444 | +static void |
445 | +make_filters(usc::SearchReplyProxy const& reply, |
446 | + Libertine::UPtr libertine, |
447 | + QStringList const& hidden, |
448 | + QStringList const& whitelist_, |
449 | + QStringList const& blacklist_, |
450 | + QStringList & excludes_by_filter, |
451 | + usc::FilterState const& filter_state |
452 | + ) |
453 | +{ |
454 | + std::map<std::string,unity::scopes::OptionSelectorFilter::SPtr> filters; |
455 | + //make exclude scope filter for apps |
456 | + for (auto const& container: libertine->get_container_list()) |
457 | + { |
458 | + std::string filter_title = std::string(_("Exclude Apps")) + ": " + container->name(); |
459 | + filters[container->id()] = unity::scopes::OptionSelectorFilter::create(container->id(), filter_title, true); |
460 | + unity::scopes::OptionSelectorFilter::SPtr filter = filters[container->id()]; |
461 | + // add exclude filter checkable items for each app that pass blacklisting + whitelisting |
462 | + for (auto const& app: container->app_launchers()) |
463 | + { |
464 | + auto excludes_map = app_keys(app.uri()); |
465 | + //only exlcude through blacklisting if not explicitly whitelisted |
466 | + QString app_id = QString::fromStdString(app.uri()).split("/")[3]; |
467 | + QString key = QString::fromStdString(container->id()) + "/" + app_id; |
468 | + if (hidden.contains(key)) |
469 | + { |
470 | + continue; |
471 | + } |
472 | + if (whitelist_.contains(key)) |
473 | + { |
474 | + filter->add_option(excludes_map["key"].toStdString(), app.name()); |
475 | + } |
476 | + else if (!blacklist_.contains(excludes_map["key"]) && !blacklist_.contains("all/" + excludes_map["name"])) |
477 | + { |
478 | + filter->add_option(excludes_map["key"].toStdString(), app.name()); |
479 | + } |
480 | + } |
481 | + //get exclude filter checked items |
482 | + if (filter->has_active_option(filter_state)) |
483 | + { |
484 | + auto excludeTypes = filter->active_options(filter_state); |
485 | + for (auto const &opt: excludeTypes) |
486 | + { |
487 | + excludes_by_filter.append(QString::fromStdString(opt->id())); |
488 | + } |
489 | + } |
490 | + } |
491 | + //push filters |
492 | + std::list<unity::scopes::FilterBase::SCPtr> filters_v; |
493 | + for (const auto& filter: filters) |
494 | + { |
495 | + if (filter.second->options().size() > 0 ) |
496 | + { |
497 | + filters_v.push_back(filter.second); |
498 | + } |
499 | + } |
500 | + reply->push(filters_v, filter_state); |
501 | +} |
502 | + |
503 | /** |
504 | * A custom rendering layout brazenly stolen from the click scope, so they look |
505 | * sorta similar. At least until they change theirs. |
506 | @@ -59,9 +175,15 @@ |
507 | Query:: |
508 | Query(usc::CannedQuery const& query, |
509 | usc::SearchMetadata const& metadata, |
510 | - Libertine::Factory const& libertine_factory) |
511 | + Libertine::Factory const& libertine_factory, |
512 | + std::string const& cache_dir, |
513 | + std::tuple<QStringList,QStringList> const& blackwhiteLists |
514 | + ) |
515 | : usc::SearchQueryBase(query, metadata) |
516 | , libertine_factory_(libertine_factory) |
517 | +, cache_dir_(cache_dir) |
518 | +, blacklist_(std::get<0>(blackwhiteLists)) |
519 | +, whitelist_(std::get<1>(blackwhiteLists)) |
520 | { |
521 | } |
522 | |
523 | @@ -70,7 +192,7 @@ |
524 | cancelled() |
525 | { |
526 | } |
527 | - |
528 | + |
529 | |
530 | unity::scopes::VariantMap |
531 | Query::settings() const |
532 | @@ -79,51 +201,102 @@ |
533 | } |
534 | |
535 | |
536 | -QStringList |
537 | -Query::blacklist() const |
538 | -{ |
539 | - QStringList blacklistedApps; |
540 | - auto blacklist = settings()["blacklist"]; |
541 | - if (!blacklist.is_null()) { |
542 | - blacklistedApps = QString::fromStdString(blacklist.get_string()) |
543 | - .remove("\"") |
544 | - .split(";", QString::SkipEmptyParts); |
545 | - } |
546 | - return blacklistedApps; |
547 | -} |
548 | - |
549 | - |
550 | void Query:: |
551 | run(usc::SearchReplyProxy const& reply) |
552 | { |
553 | - auto blacklistedApps = blacklist(); |
554 | + auto hidden = get_hidden(cache_dir_); |
555 | + // make scope departments |
556 | + if (hidden.size() > 0 ) |
557 | + { |
558 | + make_departments(reply); |
559 | + } |
560 | + |
561 | + std::pair<QStringList,QStringList> bwlists; |
562 | + std::map<QString,QString> excludes_map; |
563 | + QStringList excludes_by_filter; |
564 | QRegExp re(QString::fromStdString(query().query_string()), Qt::CaseInsensitive); |
565 | Libertine::UPtr libertine = libertine_factory_(); |
566 | |
567 | + //only provide filters in root department: X Apps |
568 | + if (query().department_id().empty()) |
569 | + { |
570 | + make_filters(reply, libertine_factory_(), hidden, whitelist_, blacklist_, excludes_by_filter, query().filter_state()); |
571 | + } |
572 | + |
573 | + //make and push results |
574 | for (auto const& container: libertine->get_container_list()) |
575 | { |
576 | auto category = reply->register_category(container->id(), |
577 | container->name(), |
578 | "Application", |
579 | usc::CategoryRenderer(CATEGORY_APPS_DISPLAY)); |
580 | + bool breaking = false; |
581 | for (auto const& app: container->app_launchers()) |
582 | { |
583 | - if (!(re.isEmpty() || QString::fromStdString(app.name()).contains(re)) |
584 | - || blacklistedApps.contains(QString::fromStdString(app.name()))) |
585 | - { |
586 | - continue; |
587 | - } |
588 | - |
589 | + //search |
590 | + if (!(re.isEmpty() || QString::fromStdString(app.name()).contains(re))) |
591 | + continue; |
592 | + |
593 | + excludes_map = app_keys(app.uri()); |
594 | + //only check for blacklisted if not whitelisted |
595 | + QString app_id; |
596 | + if (QString::fromStdString(app.uri()).split("/").size() >= 4) |
597 | + app_id = QString::fromStdString(app.uri()).split("/")[3]; |
598 | + QString key = QString::fromStdString(container->id()) + "/" + app_id; |
599 | + //don't display if blacklisted |
600 | + if (!whitelist_.contains(key)) |
601 | + { |
602 | + if (blacklist_.contains(excludes_map["key"]) || blacklist_.contains("all/" + excludes_map["name"])) |
603 | + { |
604 | + continue; |
605 | + } |
606 | + } |
607 | + //don't display apps excluded by filter |
608 | + if (excludes_by_filter.contains(excludes_map["key"])) |
609 | + { |
610 | + continue; |
611 | + } |
612 | + |
613 | + //if root department, don't display if it's a hidden app |
614 | + if (query().department_id().empty() || query().department_id() == ROOT_DEPT_ID) |
615 | + { |
616 | + if (hidden.contains(key)) |
617 | + { |
618 | + continue; |
619 | + } |
620 | + } |
621 | + else |
622 | + { |
623 | + //don't display non hidden apps in hidden dept |
624 | + if (!hidden.contains(key)) |
625 | + { |
626 | + continue; |
627 | + } |
628 | + } |
629 | usc::CategorisedResult result(category); |
630 | result.set_title(app.name()); |
631 | result.set_art(app.icon()); |
632 | result.set_uri(app.uri()); |
633 | result["description"] = app.description(); |
634 | + result["app_id"] = key.toStdString(); |
635 | + //add department id so we know which buttons to display on preview |
636 | + if (query().department_id().empty() || query().department_id() == ROOT_DEPT_ID) |
637 | + { |
638 | + result["department_id"] = ROOT_DEPT_ID; |
639 | + } |
640 | + else |
641 | + { |
642 | + result["department_id"] = "hidden"; |
643 | + } |
644 | if (!reply->push(result)) |
645 | { |
646 | + breaking = true; |
647 | break; |
648 | } |
649 | } |
650 | + if (breaking) |
651 | + { |
652 | + break; |
653 | + } |
654 | } |
655 | } |
656 | - |
657 | |
658 | === modified file 'libertine-scope/query.h' |
659 | --- libertine-scope/query.h 2016-05-04 17:56:13 +0000 |
660 | +++ libertine-scope/query.h 2016-06-08 19:55:17 +0000 |
661 | @@ -19,8 +19,7 @@ |
662 | #include "libertine-scope/libertine.h" |
663 | #include <unity/scopes/ReplyProxyFwd.h> |
664 | #include <unity/scopes/SearchQueryBase.h> |
665 | - |
666 | -class QStringList; |
667 | +#include <QStringList> |
668 | |
669 | |
670 | /** |
671 | @@ -32,7 +31,10 @@ |
672 | public: |
673 | Query(unity::scopes::CannedQuery const& query, |
674 | unity::scopes::SearchMetadata const& metadata, |
675 | - Libertine::Factory const& libertine_factory); |
676 | + Libertine::Factory const& libertine_factory, |
677 | + std::string const& cache_dir = "", |
678 | + std::tuple<QStringList,QStringList> const& = std::tuple<QStringList,QStringList>() |
679 | + ); |
680 | |
681 | ~Query() = default; |
682 | |
683 | @@ -46,9 +48,11 @@ |
684 | virtual unity::scopes::VariantMap settings() const; |
685 | |
686 | private: |
687 | - QStringList blacklist() const; |
688 | - |
689 | Libertine::Factory libertine_factory_; |
690 | + std::string scope_dir_; |
691 | + std::string cache_dir_; |
692 | + QStringList blacklist_; |
693 | + QStringList whitelist_; |
694 | }; |
695 | |
696 | #endif // LIBERTINE_SCOPE_QUERY_H_ |
697 | |
698 | === modified file 'libertine-scope/scope.cpp' |
699 | --- libertine-scope/scope.cpp 2016-01-19 21:10:09 +0000 |
700 | +++ libertine-scope/scope.cpp 2016-06-08 19:55:17 +0000 |
701 | @@ -17,10 +17,13 @@ |
702 | |
703 | #include "libertine-scope/preview.h" |
704 | #include "libertine-scope/query.h" |
705 | +#include "libertine-scope/action.h" |
706 | #include <localization.h> |
707 | #include <sstream> |
708 | -#include <unity/scopes/ActivationResponse.h> |
709 | #include <url-dispatcher.h> |
710 | +#include <QFile> |
711 | +#include <QTextStream> |
712 | +#include <QString> |
713 | |
714 | |
715 | namespace usc = unity::scopes; |
716 | @@ -28,26 +31,59 @@ |
717 | namespace |
718 | { |
719 | |
720 | -/** |
721 | - * @todo move this class into its own source file. |
722 | - */ |
723 | -class ScopeActivation |
724 | -: public usc::ActivationQueryBase |
725 | -{ |
726 | -public: |
727 | - ScopeActivation(usc::Result const& result, |
728 | - usc::ActionMetadata const& metadata) |
729 | - : ActivationQueryBase(result, metadata) |
730 | - { } |
731 | - |
732 | - usc::ActivationResponse |
733 | - activate() override |
734 | - { |
735 | - return usc::ActivationResponse(status); |
736 | - } |
737 | - |
738 | - usc::ActivationResponse::Status status = usc::ActivationResponse::Status::NotHandled; |
739 | -}; |
740 | +static bool |
741 | +is_whitelist(QString const& line) |
742 | +{ |
743 | + if (line.startsWith("whitelist")) |
744 | + { |
745 | + if (line.split("/").size() < 3) |
746 | + { |
747 | + return false; |
748 | + } |
749 | + else |
750 | + { |
751 | + return true; |
752 | + } |
753 | + } |
754 | + else |
755 | + { |
756 | + return false; |
757 | + } |
758 | +} |
759 | + |
760 | +static QString |
761 | +get_whitelist_key(QString const& line) |
762 | +{ |
763 | + QStringList parts = line.split("/"); |
764 | + return parts[1] + "/" + parts[2].trimmed(); |
765 | +} |
766 | + |
767 | +static std::tuple<QStringList,QStringList> |
768 | +get_bwlists(std::string scope_dir) |
769 | +{ |
770 | + //Get blacklisted and whitelisted apps from "blacklist" file in scope dir |
771 | + QStringList blacklist; |
772 | + QStringList whitelist; |
773 | + QFile blacklist_f(QString("%1/%2").arg(QString::fromStdString(scope_dir), QString::fromStdString("blacklist"))); |
774 | + if (blacklist_f.exists()) { |
775 | + if (blacklist_f.open(QIODevice::ReadOnly | QIODevice::Text)){ |
776 | + QTextStream in(&blacklist_f); |
777 | + while (!in.atEnd()) { |
778 | + QString line(in.readLine()); |
779 | + if (!line.startsWith("#") && !line.startsWith("whitelist")) |
780 | + { |
781 | + blacklist.append(line.trimmed()); |
782 | + } |
783 | + if (is_whitelist(line)) |
784 | + { |
785 | + whitelist.append(get_whitelist_key(line)); |
786 | + } |
787 | + } |
788 | + blacklist_f.close(); |
789 | + } |
790 | + } |
791 | + return std::tie(blacklist,whitelist); |
792 | +} |
793 | |
794 | } // anonymous namespace |
795 | |
796 | @@ -79,7 +115,11 @@ |
797 | search(usc::CannedQuery const& query, |
798 | usc::SearchMetadata const& metadata) |
799 | { |
800 | - return usc::SearchQueryBase::UPtr(new Query(query, metadata, libertine_factory_)); |
801 | + return usc::SearchQueryBase::UPtr(new Query(query, |
802 | + metadata, |
803 | + libertine_factory_, |
804 | + cache_directory(), |
805 | + get_bwlists(scope_directory()))); |
806 | } |
807 | |
808 | |
809 | @@ -97,14 +137,7 @@ |
810 | std::string const& /* widget_id */, |
811 | std::string const& action_id) |
812 | { |
813 | - auto activation = new ScopeActivation(result, metadata); |
814 | - |
815 | - if (action_id == "open") |
816 | - { |
817 | - url_dispatch_send(result.uri().c_str() , NULL, NULL); |
818 | - } |
819 | - |
820 | - return usc::ActivationQueryBase::UPtr(activation); |
821 | + return usc::ActivationQueryBase::UPtr(new Action(result, metadata, action_id, cache_directory())); |
822 | } |
823 | |
824 | |
825 | |
826 | === modified file 'po/libertine-scope.pot' |
827 | --- po/libertine-scope.pot 2016-06-02 17:13:50 +0000 |
828 | +++ po/libertine-scope.pot 2016-06-08 19:55:17 +0000 |
829 | @@ -8,7 +8,7 @@ |
830 | msgstr "" |
831 | "Project-Id-Version: PACKAGE VERSION\n" |
832 | "Report-Msgid-Bugs-To: \n" |
833 | -"POT-Creation-Date: 2016-06-02 13:05-0400\n" |
834 | +"POT-Creation-Date: 2016-06-08 19:33+0000\n" |
835 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
836 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
837 | "Language-Team: LANGUAGE <LL@li.org>\n" |
838 | |
839 | === modified file 'tests/TypedScopeFixture.h' |
840 | --- tests/TypedScopeFixture.h 2016-01-19 05:10:54 +0000 |
841 | +++ tests/TypedScopeFixture.h 2016-06-08 19:55:17 +0000 |
842 | @@ -85,6 +85,7 @@ |
843 | { |
844 | TypedScopeFixtureHelper::set_registry(scope, registry_proxy); |
845 | TypedScopeFixtureHelper::set_scope_directory(scope, "/tmp"); |
846 | + TypedScopeFixtureHelper::set_cache_directory(scope, "/tmp"); |
847 | TypedScopeFixtureHelper::set_app_directory(scope, "/tmp"); |
848 | } |
849 | |
850 | |
851 | === modified file 'tests/fake_container_json.h' |
852 | --- tests/fake_container_json.h 2016-04-27 17:53:30 +0000 |
853 | +++ tests/fake_container_json.h 2016-06-08 19:55:17 +0000 |
854 | @@ -32,7 +32,7 @@ |
855 | "name": "Panel Manager", |
856 | "no_display": false, |
857 | "description": "some description", |
858 | - "uri": "some/uri" |
859 | + "uri": "some/uri/pad1/pad2/" |
860 | }, |
861 | { |
862 | "desktop_file_name": "/home/someuser/.cache/libertine-container/fake1/rootfs/usr/share/applications/sakura.desktop", |
863 | @@ -44,7 +44,7 @@ |
864 | "name": "Sakura", |
865 | "no_display": false, |
866 | "description": "some other description", |
867 | - "uri": "some/other/uri" |
868 | + "uri": "some/other/uri/pad" |
869 | } |
870 | ] |
871 | } |
872 | |
873 | === modified file 'tests/test_preview.cpp' |
874 | --- tests/test_preview.cpp 2016-04-27 17:53:30 +0000 |
875 | +++ tests/test_preview.cpp 2016-06-08 19:55:17 +0000 |
876 | @@ -28,6 +28,7 @@ |
877 | TEST(TestPreview, pushesWidgetsWithAppInformation) |
878 | { |
879 | unity::scopes::testing::Result result; |
880 | + result["department_id"] = ""; |
881 | unity::scopes::ActionMetadata metadata("en_US", "phone"); |
882 | |
883 | std::unique_ptr<unity::scopes::PreviewWidgetList> list(new unity::scopes::PreviewWidgetList()); |
884 | @@ -57,7 +58,7 @@ |
885 | EXPECT_EQ("actions", buttons.widget_type()); |
886 | |
887 | auto buttons_actions = buttons.attribute_values()["actions"].get_array(); |
888 | - ASSERT_EQ(1, buttons_actions.size()); |
889 | + ASSERT_EQ(2, buttons_actions.size()); |
890 | EXPECT_EQ("open", buttons_actions[0].get_dict()["id"].get_string()); |
891 | EXPECT_EQ("Open", buttons_actions[0].get_dict()["label"].get_string()); |
892 | } |
893 | |
894 | === modified file 'tests/test_query.cpp' |
895 | --- tests/test_query.cpp 2016-04-27 18:37:46 +0000 |
896 | +++ tests/test_query.cpp 2016-06-08 19:55:17 +0000 |
897 | @@ -34,19 +34,19 @@ |
898 | "app_launchers": [{ |
899 | "name": "LibreOffice", |
900 | "no_display": false, |
901 | - "uri": "appid://fake/libreoffice/0.0", |
902 | + "uri": "appid://fake-container/libreoffice/0.0", |
903 | "icons": ["file:///lo.png"], |
904 | "description": "libreoffice!" |
905 | }, { |
906 | "name": "Linux", |
907 | "no_display": true, |
908 | - "uri": "appid://fake/linux/0.0", |
909 | + "uri": "appid://fake-container/linux/0.0", |
910 | "icons": ["file:///nix.png"], |
911 | "description": "linux!" |
912 | }, { |
913 | "name": "Library", |
914 | "no_display": false, |
915 | - "uri": "appid://fake/library/0.0", |
916 | + "uri": "appid://fake-container/library/0.0", |
917 | "icons": ["file:///lib.png"], |
918 | "description": "library!" |
919 | }] |
920 | @@ -100,17 +100,17 @@ |
921 | |
922 | void expect_push_libreoffice(bool success = true) |
923 | { |
924 | - expect_push("LibreOffice", "file:///lo.png", "libreoffice!", "appid://fake/libreoffice/0.0", success); |
925 | + expect_push("LibreOffice", "file:///lo.png", "libreoffice!", "appid://fake-container/libreoffice/0.0", success); |
926 | } |
927 | |
928 | void expect_push_library(bool success = true) |
929 | { |
930 | - expect_push("Library", "file:///lib.png", "library!", "appid://fake/library/0.0", success); |
931 | + expect_push("Library", "file:///lib.png", "library!", "appid://fake-container/library/0.0", success); |
932 | } |
933 | |
934 | void expect_push_linux(bool success = true) |
935 | { |
936 | - expect_push("Linux", "file:///nix.png", "linux!", "appid://fake/linux/0.0", success); |
937 | + expect_push("Linux", "file:///nix.png", "linux!", "appid://fake-container/linux/0.0", success); |
938 | } |
939 | |
940 | unity::scopes::SearchMetadata metadata; |
941 | @@ -127,7 +127,6 @@ |
942 | expect_push_libreoffice(); |
943 | expect_push_linux(); |
944 | expect_push_library(); |
945 | - |
946 | Query query(canned_query, metadata, []() { |
947 | return FakeLibertine::make_fake(LIBERTINE_OUTPUT_WITH_APPS); |
948 | }); |
949 | @@ -160,50 +159,32 @@ |
950 | } |
951 | |
952 | |
953 | -// Query class with faked out Settings |
954 | -class QueryWithFakeSettings : public Query |
955 | -{ |
956 | -public: |
957 | - QueryWithFakeSettings(unity::scopes::CannedQuery const& query, |
958 | - unity::scopes::SearchMetadata const& metadata, |
959 | - Libertine::Factory const& libertine_factory) |
960 | - : Query(query, metadata, libertine_factory) |
961 | - , settings_() |
962 | - { |
963 | - } |
964 | - |
965 | - unity::scopes::VariantMap settings() const override |
966 | - { |
967 | - return settings_; |
968 | - } |
969 | - |
970 | - unity::scopes::VariantMap settings_; |
971 | -}; |
972 | - |
973 | - |
974 | TEST_F(TestQueryFixture, ignoresAnyBlacklistedApps) |
975 | { |
976 | expect_registry(); |
977 | + expect_push_linux(); |
978 | expect_push_library(); |
979 | - |
980 | - QueryWithFakeSettings query(canned_query, metadata, []() { |
981 | + QStringList blacklist = {"fake-container/libreoffice"}; |
982 | + QStringList whitelist = {}; |
983 | + std::tuple<QStringList,QStringList> lists(blacklist, whitelist); |
984 | + Query query(canned_query, metadata, []() { |
985 | return FakeLibertine::make_fake(LIBERTINE_OUTPUT_WITH_APPS); |
986 | - }); |
987 | - query.settings_["blacklist"] = "LibreOffice;Linux"; |
988 | + }, "/tmp", lists); |
989 | query.run(proxy); |
990 | } |
991 | |
992 | |
993 | -TEST_F(TestQueryFixture, stripsQuotationMarksFromBlacklist) |
994 | +TEST_F(TestQueryFixture, displayWhitelistedApps) |
995 | { |
996 | expect_registry(); |
997 | expect_push_linux(); |
998 | expect_push_library(); |
999 | - |
1000 | - QueryWithFakeSettings query(canned_query, metadata, []() { |
1001 | + QStringList blacklist = {"all/libreoffice"}; |
1002 | + QStringList whitelist = {"fakeId/liberoffice"}; |
1003 | + std::tuple<QStringList,QStringList> lists(blacklist, whitelist); |
1004 | + Query query(canned_query, metadata, []() { |
1005 | return FakeLibertine::make_fake(LIBERTINE_OUTPUT_WITH_APPS); |
1006 | - }); |
1007 | - query.settings_["blacklist"] = "\"LibreOffice\""; |
1008 | + }, "/tmp", lists); |
1009 | query.run(proxy); |
1010 | } |
1011 |
A couple of things on my first pass of this.
One, the tests segfault with this MP, so the package won't build. That definitely needs fixing.
Two, I'd like to see some sort of global filter that applies to all containers by default with some way to override that on a per container basis. For example, in the previous settings blacklist, we are setting those particular apps as hidden and would like to keep it that way with this method.