Bug 301971 - activity linked files are not shown after system restart
Summary: activity linked files are not shown after system restart
Status: RESOLVED FIXED
Alias: None
Product: plasma4
Classification: Plasma
Component: widget-folderview (show other bugs)
Version: 4.9.97 RC2
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Ignat Semenov
URL:
Keywords:
: 302331 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-06-15 15:10 UTC by Robby Engelmann
Modified: 2013-01-20 05:24 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.10


Attachments
Activities KIO slave without Consumer (4.47 KB, patch)
2013-01-16 05:48 UTC, David E. Narvaez
Details
Instrumentation for detecting when Nepomuk loads the required ontologies (4.69 KB, patch)
2013-01-16 06:02 UTC, David E. Narvaez
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robby Engelmann 2012-06-15 15:10:56 UTC
To an activity linked file are not shown in folderview after restart. You first need to switch to another activity and back.

Reproducible: Always

Steps to Reproduce:
1.link a file to a specific activity
2.add folderview to that activity
3.setup folderview to only show activity-related files (the one file show up)
4.perform system restart
5.system starts in the last activity and folderview is empty
6.switch to another activity
7.switch back and you will see the file show up again
Actual Results:  
folderview does not populate the view with associated files, only visible after a switch to another activity

Expected Results:  
folderview should show files right after startup
Comment 1 Cyril Brosch 2012-09-20 07:44:33 UTC
This may be duplicate of https://bugs.kde.org/show_bug.cgi?id=302331 - however, switching activities doesn't help here, folderview rests empty.
Comment 2 David E. Narvaez 2013-01-16 04:48:30 UTC
*** Bug 302331 has been marked as a duplicate of this bug. ***
Comment 3 David E. Narvaez 2013-01-16 05:25:30 UTC
Well, we have a couple of situations here that are working together to cause bug 302331 and this bug. First let me add a couple of easy steps to reproduce buggy behaviors of displaying files linked to activities.

(These all assume you have 2 or more activities and you have different files associated to at least 2 of them)

Broken from Dolphin:
1. Open Dolphin
2. Associate it to all activities
3. Navigate to activities:/current
4. Switch to another activities

- Actual Results: Same files are shown
- Expected Results: Files should change when you switch from one activity to another

Broken folderview
1. Add a folderview to an activity and configure it to show files from current activity
2. Do the same for another activity
3. If lucky, files will show up 

- Actual Results: Same files are shown  across activities
- Expected Results: Each folderview should display files for their respective activities

Broken folderviews on reboot
1. Reboot
2. Look at the folderviews

- Actual Results: No files are shown
- Expected Results: Folderviews should display files linked to activities

In some cases, the F5 workaround will do the job, but it is annoying. In my personal case, the F5 workaround works on my laptop (KDE 4.9, x86) and won't work on my Desktiop (KDE 4.10 RC2, x86_64).
Comment 4 David E. Narvaez 2013-01-16 05:39:24 UTC
Git commit 6522c4b88d7c32584e766a3972b5699dc0b2c977 by David E. Narváez.
Committed on 16/01/2013 at 06:38.
Pushed by narvaez into branch 'KDE/4.10'.

This won't help much in the general case, but it is at least sound.

M  +2    -0    src/service/NepomukActivityManager.cpp

http://commits.kde.org/kactivities/6522c4b88d7c32584e766a3972b5699dc0b2c977
Comment 5 David E. Narvaez 2013-01-16 05:48:53 UTC
Created attachment 76502 [details]
Activities KIO slave without Consumer

While reporting that the files of the activities:/current changed is already done when switching from one activity to another, I noticed the Activities KIO slave is never notified of the change of the activity. For some reason, the signals are never activated, and the current activity is never changed inside the consumer of the KIO slave.

I ended up reworking the KIO slave with the attached patch, to call DBus methods directly to fetch the information, and this works. I still have no idea of why won't signals activate in the KIO slave, but given the little time we have to make this work I'd like this change to go into 4.10 at least while we can figure out exactly what's happening.
Comment 6 David E. Narvaez 2013-01-16 05:50:52 UTC
Related to the patch above, the F5 workaround works only in those cases where kdeinit4 starts a new slave for each reload. In cases where the same slave is used between reloads, F5 is useless since the slave still has no idea that files changed.
Comment 7 David E. Narvaez 2013-01-16 06:02:10 UTC
Created attachment 76503 [details]
Instrumentation for detecting when Nepomuk loads the required ontologies

The other part of the issue, the one related with rebooting, is caused by the fact that Nepomuk, when initialized, does not have all the ontologies needed to resolve a query for linked resources. The attached patch (which is clearly not suited for 4.10) instruments the NepomukActivityManager class to notify changes in activities:/current 10 seconds after the last ontology is loaded. There are some easy ways to break this logic, but it works for the general case and serves as an example of what we need to have in place to properly load linked resources on boot.

If Nepomuk published the ontologiesUpdated signal on DBus, as I first suggested a couple of releases ago when working on the Activity Icons issue, we would need less artillery to know when to notify of directory changes.

At this point, both things will not be in place for 4.10 so we can only stick to the F5 workaround once the KIO Slave is fixed. Notice that the KIO slave patch above also replaces the Nepomuk call because it is also broken in the  slave - presumably for the same reason the signals  are not being called - and that's why the KIO slave fix is required for this Nepomuk integration to work.
Comment 8 Ivan Čukić 2013-01-16 08:41:06 UTC
Hi David,

For the first patch, you have my green light to push it in 4.10 (it would be nice if you had a few people that use 4.10 branch to test it first) with one note - kactivities code doesn't really use variables named 'somethingIface' - just 'someting' is fine.

For the second patch, it really (as you noted) needs to go into nepomuk. I'd even say that saying that Nepomuk::ResourceManager must not report it has initialized itself before the ontologies are loaded - it is not really useful before that.
Comment 9 Vishesh Handa 2013-01-16 10:37:11 UTC
(In reply to comment #8)
>
> For the second patch, it really (as you noted) needs to go into nepomuk. I'd
> even say that saying that Nepomuk::ResourceManager must not report it has
> initialized itself before the ontologies are loaded - it is not really
> useful before that.

Agreed. If it is not too much trouble, could someone make a bug report for that in nepomuk? Just so that I do not forget?
Comment 10 Ivan Čukić 2013-01-16 10:44:19 UTC
Added - it is the bug #313357
Comment 11 David E. Narvaez 2013-01-16 15:01:03 UTC
Git commit f00c07f443ba471f0c65cd6774f4c05245428c3e by David E. Narváez.
Committed on 16/01/2013 at 16:00.
Pushed by narvaez into branch 'KDE/4.10'.

Replace the Consumer code with direct DBus calls in the KIO slave

M  +17   -0    src/workspace/kio/CMakeLists.txt
M  +14   -29   src/workspace/kio/KioActivities.cpp
M  +1    -1    src/workspace/kio/KioActivities.h

http://commits.kde.org/kactivities/f00c07f443ba471f0c65cd6774f4c05245428c3e
Comment 12 David E. Narvaez 2013-01-16 15:03:17 UTC
We will use RC3 to test the KIO slave with Consumer replaced and if anything goes terribly wrong (e.g., bad performance) I guess we have to revert this before 4.10. I'll also keep an eye on the situation with DBus calls in the slave, since it would be idea to use Consumer in this code too.
Comment 13 Ignat Semenov 2013-01-16 15:06:46 UTC
Honestly, I can not work with this bug at all since I can't get Nepomuk to work here, neither in a binary (packaged) kde, nor in a kde built from source. Thus there is no way to test this functionality and/or reproduce the bug.
Comment 14 Robby Engelmann 2013-01-16 16:28:14 UTC
I would be willing to test, but somebody here should advice how to test.
I am using Kubuntu raring and get RC3 as soon as it is in its repos.
Comment 15 David E. Narvaez 2013-01-17 05:38:47 UTC
Git commit 33d6137dc44cb11adbd8759ad01992b7e342a901 by David E. Narváez.
Committed on 17/01/2013 at 06:38.
Pushed by narvaez into branch 'KDE/4.10'.

Adapting code to correct naming convention as pointed out by Ivan

M  +4    -4    src/workspace/kio/KioActivities.cpp

http://commits.kde.org/kactivities/33d6137dc44cb11adbd8759ad01992b7e342a901
Comment 16 David E. Narvaez 2013-01-17 13:07:00 UTC
(In reply to comment #14)
> I would be willing to test, but somebody here should advice how to test.
> I am using Kubuntu raring and get RC3 as soon as it is in its repos.

Thanks! Unfortunately RC3 will ship with just a partial fix: you should be able to see the correct files displayed either in in folderviews or a dolphin instance pointing to activities:/current when you switch activities; yet, these will not be populated on their own once you log into your session so you will need to switch from one activity to another in order to see the files or use the F5 workaround which should now be reliable.

Notice that files linked to activities are not readily available at session start, since these are provided by Nepomuk so you need to wait for it to be initialized which, depending on your system load, will happen in a matter of seconds.

Fortunately, 4.10 will ship with the full solution to this issue.
Comment 17 David E. Narvaez 2013-01-18 01:51:20 UTC
Git commit f5ae740caf346f263f485981d9bee7a5a3a3acfb by David E. Narváez.
Committed on 18/01/2013 at 02:49.
Pushed by narvaez into branch 'KDE/4.10'.

Sync Activities Regardless of Nepomuk Status

NepomukActivityManager::syncActivities handles internally the presence
of the Nepomuk Service, and if the service is not initialized, it
populates the m_cache_activityIds list, which is later required to be
non-empty to sync again with Nepomuk in
NepomukActivityManager::nepomukServiceStarted.
FIXED-IN: 4.10
REVIEW: 108446

M  +2    -15   src/service/NepomukActivityManager.cpp

http://commits.kde.org/kactivities/f5ae740caf346f263f485981d9bee7a5a3a3acfb
Comment 18 David E. Narvaez 2013-01-20 05:24:13 UTC
Git commit cc81c1fca79896385f23bccf939004658df327f2 by David E. Narváez.
Committed on 20/01/2013 at 06:23.
Pushed by narvaez into branch 'KDE/4.10'.

Committing the other variable name change that was missing

M  +3    -3    src/workspace/kio/KioActivities.cpp

http://commits.kde.org/kactivities/cc81c1fca79896385f23bccf939004658df327f2