Skip to main content

SdcardLocator

SdcardLoactor is an helper class to detect status and location of a sdcard on sfos phones. Primary made for SailfishOs

  • simple, only consist of 1 class to add to your project
  • qml ready, just register the service and use one of the 3 properties
Some example

You can use SdcardLocator from both Qt and Qml

Registering the service"
// from the main process
QScopedPointer app(SailfishApp::application(argc, argv));
QScopedPointer view(SailfishApp::createView());

// register the locator into qml with the default service name
SdcardLocator::init(view->rootContext());
from Qml
var sdcardStatus = SdcardLocator.present;
var sdcardLocation = SdcardLocator.location;
var sdcardType = SdcardLocator.type;
from CPP
bool sdcardPresent = SdcardLocator::getInstance().isPresent();
Install

Install is really simple and only require to add the lib to your project. Steps assume you use the default names and locations

  1. Copy the src/sdcardlocator directory into your src directory
  2. Edit the project's .pro file and include sdcardlocator.pri reference

From Github or inside the .tgz you will find a full qtcreator project.

Download

You can get SdCardLocator from the github repository

Editing .pro file

Here the .pro file for the sample application (Sailfish app)

TARGET = harbour-test_sdcardLocator

CONFIG += sailfishapp

include(src/sdcardlocator/sdcardlocator.pri)

SOURCES += src/harbour-test_sdcardLocator.cpp

DISTFILES += qml/harbour-test_sdcardLocator.qml \
    qml/cover/*.qml \
    qml/pages/*.qml \
    qml/composents/*.qml \
    rpm/harbour-test_sdcardLocator.changes \
    rpm/harbour-test_sdcardLocator.spec \
    rpm/harbour-test_sdcardLocator.yaml \
    harbour-test_sdcardLocator.desktop

SAILFISHAPP_ICONS = 86x86 108x108 128x128 256x256