Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Contributor
Posts: 4
Registered: ‎04-02-2013
My Device: BlackBerry Z10
My Carrier: vodafone

FilePicker - directory issue

Hello,

 

I've a little problem with FilePicker. I've tried to set directories property to (e.g.) "./data/" (I filled this dir with some images) but, when the picker starts, it show no files.
Am I doing something wrong?

Thanks.

 

Developer
Posts: 17
Registered: ‎04-06-2013
My Device: Z10
My Carrier: Vodafone

Re: FilePicker - directory issue

the QUrl is right?

Developer
Posts: 188
Registered: ‎09-03-2012
My Device: Blackberry 10

Re: FilePicker - directory issue

I would recommend using the following approach:

In your cpp file:

    // Retrieve the path to the app's working directory
    QString workingDir = QDir::currentPath();

    // Build the path, add it as a context property, and expose
    // it to QML
    QDeclarativePropertyMap* dirPaths = new QDeclarativePropertyMap;
    dirPaths->insert("camera", QVariant(QString("file://" + workingDir + "/shared/testdir")));

In your qml:

 

        FilePicker {
            id: filePicker
            type: FileType.Picture
            title: "bleh"
            directories: [ dirPaths.camera ]
            onFileSelected: {
                       // code here
            }
        }

New Contributor
Posts: 4
Registered: ‎04-02-2013
My Device: BlackBerry Z10
My Carrier: vodafone

Re: FilePicker - directory issue

I tried this solution too, but without luck.

Also, the weird thing is that if I set FileType.Picture , it open the camera directory.

Developer
Posts: 188
Registered: ‎09-03-2012
My Device: Blackberry 10

Re: FilePicker - directory issue

Try debugging.. it should work. I have this exact code in my app.
Developer
Posts: 654
Registered: ‎02-03-2010
My Device: Z10 LE
My Carrier: Rogers

Re: FilePicker - directory issue

Just want to make sure you set the permission for 'Shared Files' in the bar-descriptor.


Steven Kader at JaredCo
   Follow me on Twitter    |     Mipixi.com :  Web App for Photo Sharing
Highlighted
New Contributor
Posts: 4
Registered: ‎04-02-2013
My Device: BlackBerry Z10
My Carrier: vodafone

Re: FilePicker - directory issue

I've tried to debug, no errors shows up...maybe the only interesting thing is this :

 

FilePickerPrivate::onCardInvokeRequestFinished()  . error= 0

 @JaredCo : yes, the permission has already been set.