Bug 348347

Summary: Can't create albums - menu is greyed out
Product: [Applications] digikam Reporter: Christian Butcher <chrisb2244>
Component: Usability-MenusAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: grave CC: caulier.gilles, marcel.wiesweg
Priority: NOR    
Version: 5.0.0   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 5.0.0
Sentry Crash Report:

Description Christian Butcher 2015-05-28 05:16:07 UTC
digiKam opens. 
Possibly of note, output includes 

'digikam.general: Folder does not exist or is not readable: "file:/home/christian/Pictures" '

The folder does exist. Permissions are:
    $ ls -ld /home/christian/Pictures/
    drwxr-xr-x 3 christian christian 4096 May 28 13:58 /home/christian/Pictures/
    $ ls -l /home/christian/Pictures/
    total 88
    -rw-r--r-- 1 christian christian 66560 May 28 13:58 digikam4.db
    drwxr-xr-x 2 christian christian  4096 May 22 18:17 Experiments
    -rw-r--r-- 1 christian christian 16384 May 28 13:58 thumbnails-digikam.db

Running 
    $ sqlite3 -line thumbnails-digikam.db 'pragma integrity_check;'
gives
    integrity_check = ok

digiKam is 5.0.0-git.

Clicking on the 'Album' menu within digiKam opens the menu list, but all options are greyed out.

Using 'Import -> Cameras -> camera(auto-detected)' brings up a window into which pictures on the camera load. Clicking one of these, then selecting 'Download selected'  opens a window to select the album to save into - no albums are listed, and clicking the button 'New Album' does nothing.

I'm sure this is some problem I've created for myself with a poor installation, but some help or tips to debug would be appreciated.

As a possible additional note (although probably unrelated): When I close digiKam, either using the (x) at the top right, or with the 'Browse -> Quit' button, the konsole in which I opened digiKam reports:
    libkdcraw: Cancel Main Thread
    libkdcraw: Cancel Main Thread
    Segmentation fault


Reproducible: Always

Steps to Reproduce:
1. Open digiKam
2. Try to create new folder, etc
3.

Actual Results:  
Greyed out menu for 'Album'

Expected Results:  
Allow the creation of new albums, either from the main application, or subsequent menus such as the 'Import' menu after selecting photographs to download

digiKam from git, along with KF5, Qt5 installations.

No Qt4 on the system.
No MySQL on the system - digiKam built with support only for sqlite3.
Some optional libraries for digiKam are not installed - cmake reports that I could additionally use:
  MySQL
  libkgeomap (version >= 5.0.0)
  liblqr-1 (>= 0.4.1)
  doxygen (>= 1.8.0)
  libkdepimlibs (>= 5.0.0)

Unsure where to next look to solve this issue.
Camera is a Nikon V2, supported by libgphoto2. digiKam is happy to autodetect, although adding it to the cameras tab of the settings is seemingly forgotten each time - possibly due to the segmentation fault on exit?
Comment 1 caulier.gilles 2015-05-28 06:59:21 UTC
>'digikam.general: Folder does not exist or is not readable: "file:/home/christian/Pictures" '

This is clearly a problem from your file-sytem.

Problem is not reproducible here. Menu is enabled.

> segmentation fault on exit? It's due to a QString problem from image editor tools. It's identified and will be fixed.

Gilles Caulier
Comment 2 Christian Butcher 2015-05-28 07:07:23 UTC
/home is mounted by /etc/fstab.
Since it's not on the root partition, I considered trying a directory on /.

Created /photos, chown'd to christian:christian.

Added a 'Collection' within digikam at '/photos'.

Output in console window:
digikam.general: addLocation  QUrl("file:file:/photos")
digikam.general: Failed to detect a storage volume for path  "file:/photos/"  with Solid
digikam.general: Unable to identify a path with Solid. Adding the location with path only.
digikam.general: Creating new Location  "/"  uuid  "volumeid:?path=file:/photos"
digikam.general: location for  "file:/home/christian/Pictures"  is available  true
digikam.general: location for  "file:/photos"  is available  true
digikam.dimg: Searching ICC profile from data directory with relative path: "libkdcraw/profiles/prophoto.icm"
digikam.dimg: Searching ICC profile from data directory with relative path: "libkdcraw/profiles/widegamut.icm"
digikam.dimg: Searching ICC profile from data directory with relative path: "libkdcraw/profiles/srgb-d65.icm"
digikam.general: User of DWItemDelegate should not delete widgets created by createItemWidgets!
digikam.general: User of DWItemDelegate should not delete widgets created by createItemWidgets!
digikam.general: User of DWItemDelegate should not delete widgets created by createItemWidgets!
digikam.general: User of DWItemDelegate should not delete widgets created by createItemWidgets!
digikam.general: User of DWItemDelegate should not delete widgets created by createItemWidgets!
digikam.general: User of DWItemDelegate should not delete widgets created by createItemWidgets!
digikam.general: User of DWItemDelegate should not delete widgets created by createItemWidgets!
digikam.general: User of DWItemDelegate should not delete widgets created by createItemWidgets!
digikam.general: User of DWItemDelegate should not delete widgets created by createItemWidgets!
digikam.general: User of DWItemDelegate should not delete widgets created by createItemWidgets!
digikam.general: User of DWItemDelegate should not delete widgets created by createItemWidgets!
digikam.general: User of DWItemDelegate should not delete widgets created by createItemWidgets!
digikam.general: User of DWItemDelegate should not delete widgets created by createItemWidgets!
digikam.general: User of DWItemDelegate should not delete widgets created by createItemWidgets!
digikam.general: scan mode: CompleteCollectionScan
digikam.general: Folder does not exist or is not readable:  "file:/home/christian/Pictures"
digikam.general: Folder does not exist or is not readable:  "file:/photos"
digikam.general: items to tag ()
digikam.general: Complete scan took: 3 msecs.
digikam.general: total scan value :  0
digikam.general: total scan value :  0
digikam.general: Folder does not exist or is not readable:  "file:/home/christian/Pictures"
digikam.general: Folder does not exist or is not readable:  "file:/photos"
digikam.general: Complete scan (file scanning deferred) took: 2 msecs.
digikam.general: Event is dispatched through a passive pop-up
QLayout: Attempting to add QLayout "" to QWidget "", which already has a layout


Is my problem related to the 
'QUrl("file:file:/photos") '
line, or the
'Unable to identify a path with Solid'
line?
Comment 3 Christian Butcher 2015-05-29 01:02:33 UTC
solid-hardware5 query "StorageAccess.filePath == '/'" returns 
  udi = '/org/freedesktop/UDisks2/block_devices/sda9'

solid-hardware5 query "StorageAccess.filePath == '/home'" returns 
  udi = '/org/freedesktop/UDisks2/block_devices/sda10'

I'm unsure how to test if it can get to non-mountpoint filePaths, since the attributes hold only the mount points, as far as I can tell from 

solid-hardware5 list details
or
solid-hardware5 details '/org/freedesktop/UDisks2/block_devices/sda9'
solid-hardware5 details '/org/freedesktop/UDisks2/block_devices/sda10'
Comment 4 caulier.gilles 2015-05-29 05:54:10 UTC
Marcel,

Christian in this file has some questions about Solid and mount point...

Gilles
Comment 5 Christian Butcher 2015-05-29 06:23:18 UTC
So, the problem appears to be that (for some reason I don't understand, and which is obviously dependent on some poor configuration on my system), the 

'item.path' in utilities/setup/collections/setupcollectionview.cpp is being prepended with 'file:/' or 'file:///'.

If I add the lines
QString longFileStart = QString::fromLatin1("file://");
        QString shortFileStart = QString::fromLatin1("file:");
        if (item.path.startsWith(longFileStart))
        //if (item.path.left(7) == longFileStart)
        {
            qCDebug(DIGIKAM_GENERAL_LOG) << "item.path starts with 'file://'. Removing this prefix (it will be readded)";
            item.path = item.path.right(item.path.size() - 7);
            qCDebug(DIGIKAM_GENERAL_LOG) << "new item.path = " << item.path;
        }
        else if (item.path.startsWith(shortFileStart))
        //else if (item.path.left(5) == shortFileStart)
        {
            qCDebug(DIGIKAM_GENERAL_LOG) << "item.path starts with 'file:'. Removing this prefix (it will be readded)";
            item.path = item.path.right(item.path.size() - 5);
            qCDebug(DIGIKAM_GENERAL_LOG) << "new item.path = " << item.path;
        }

at around line 417, then my digiKam installation will happily add the collection, and import photographs, etc etc...

I'm pretty sure this isn't even remotely a good solution (especially since I don't know what else is broken by my system returning strange paths).

It would seem that this has something to do with the QUrl::fromLocalFile(...) function. I don't know where, but it would seem that this could be being called twice, once earlier than intended (before the QUrl is passed to SetupCollectionModel::apply() ).

I'm using the git repo qt-5. I'm not sure if this has made some change which is upsetting matters, but I did have to add some includes to digiKam files, in order to make it build. 

The list is as follows (but they seem like reasonable #includes, since the classes are explicitly referenced in the files)
QDataStream or QObject in:
  app/dragdrop/ddragobjects.cpp
  utilities/advancedrename/advancedrenamemanager.h
  libs/database/collection/collectionmanager.h
  libs/dimg/filters/curves/imagecurves.cpp

QMap in:
  libs/database/item/imagetagpair.h
  libs/database/utils/tagproperties.h
Comment 6 caulier.gilles 2015-08-13 08:02:06 UTC
digiKam 4.12.0 is out.

https://www.digikam.org/node/741

Problem still reproducible ?

Gilles Caulier
Comment 7 Christian Butcher 2015-08-25 01:25:18 UTC
TLDR: git frameworks branch seems to have fixed. Thanks!

I may have missed a Cmake define, but can v4.12.0 be built without Qt4? I have only Qt5 (qtdiag returns as the first couple of lines: 

Qt 5.5.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 4.9.2) on "xcb" 
OS: Linux 4.1.0-rc8 [linux version 4.1.0-rc8]

I built the frameworks branch of the git repository, after updating libkdcraw for its WorkingPixmap class (or similar). I don't know if cmake can check the version of libkdcraw - mine was too old at 3 commits from the frameworks branch.

Having built the frameworks branch (MediaPlayer disabled - I have some problem with gstreamer 0.1/1.0) the digikam/build/app/digikam ran fine. After installation to CMAKE_INSTALL_PREFIX, problem appears to be fixed. 

Thanks!