void BubbleManager::registerAsService()
{
    QDBusConnection connection = QDBusConnection::sessionBus();
    connection.interface()->registerService(NotificationsDBusService,
                                                  QDBusConnectionInterface::ReplaceExistingService,
                                                  QDBusConnectionInterface::AllowReplacement);
    connection.registerObject(NotificationsDBusPath, this);

    QDBusConnection ddenotifyConnect = QDBusConnection::sessionBus();
    ddenotifyConnect.interface()->registerService(DDENotifyDBusServer,
                                                  QDBusConnectionInterface::ReplaceExistingService,
                                                  QDBusConnectionInterface::AllowReplacement);
    ddenotifyConnect.registerObject(DDENotifyDBusPath, this);
}
/*!
    Destroy this QCop service handling object.
*/
QtopiaAbstractService::~QtopiaAbstractService()
{
#if defined(QTOPIA_DBUS_IPC)
    QDBusConnection dbc = QDBus::sessionBus();
    if (!dbc.isConnected()) {
        qWarning() << "Unable to connect to D-BUS:" << dbc.lastError();
        return;
    }

    qLog(Services) << "Unregistering service" << m_data->m_service;

    QString path = dbusPathBase;
    path.append(m_data->m_service);
    dbc.unregisterObject(path);

    QDBusConnectionInterface *iface = dbc.interface();
    QString service = dbusInterface;
    service.append(".");
    service.append(m_data->m_service);

    iface->unregisterService(service);
#endif

    if (m_data)
        delete m_data;
}
MprisManager::MprisManager(QObject *parent)
    : QObject(parent)
    , m_singleService(false)
    , m_playbackStatusMapper(new QSignalMapper(this))
{
    QDBusConnection connection = QDBusConnection::sessionBus();

    if (!connection.isConnected()) {
//        qmlInfo(this) << "Failed attempting to connect to DBus";
        return;
    }

    connection.connect(dBusService, dBusObjectPath, dBusInterface, dBusNameOwnerChangedSignal,
                       QStringList(), QString(),
                       this, SLOT(onNameOwnerChanged(QString, QString, QString)));

    QStringList serviceNames = connection.interface()->registeredServiceNames();
    QStringList::const_iterator i = serviceNames.constBegin();
    while (i != serviceNames.constEnd()) {
        QRegExp rx(mprisNameSpace);
        rx.setPatternSyntax(QRegExp::Wildcard);
        if (rx.exactMatch(*i)) {
            onServiceAppeared(*i);
        }

        ++i;
    }
}
Mpris2Engine::Mpris2Engine(QObject *parent)
    : QObject(parent)
{
    const QDBusConnection bus = QDBusConnection::sessionBus();
    const QStringList services = bus.interface()->registeredServiceNames();

    for (const QString &name: services.filter(mprisInterface)) {
        qCDebug(MPRIS2) << "Found player" << name;
        m_players.append(new Mpris2Player(name));
        Q_EMIT playersChanged();
    }

    m_watcher = new QDBusServiceWatcher(this);
    connect(m_watcher, &QDBusServiceWatcher::serviceOwnerChanged, [=](const QString &name, const QString &oldOwner, const QString &newOwner) {
        if (oldOwner.isEmpty() && name.startsWith(mprisPrefix)) {
            qCDebug(MPRIS2) << "Found new player" << name;
            m_players.append(new Mpris2Player(name));
        } else if (newOwner.isEmpty() && name.startsWith(mprisPrefix)) {
            for (int i = 0; i < m_players.size(); i++) {
                if (m_players.at(i)->serviceName() == name) {
                    qCDebug(MPRIS2) << "Remove player" << name;
                    m_players.takeAt(i)->deleteLater();
                    Q_EMIT playersChanged();
                    break;
                }
            }
        }
    });
}
Exemple #5
0
void tst_QDBusPerformance::initTestCase()
{
    QDBusConnection con = QDBusConnection::sessionBus();
    QVERIFY(con.isConnected());

    QDBusServiceWatcher watcher(serviceName, con,
                                QDBusServiceWatcher::WatchForRegistration);
    connect(&watcher, SIGNAL(serviceRegistered(QString)),
            &QTestEventLoop::instance(), SLOT(exitLoop()));

#ifdef Q_OS_WIN
    proc.start("server");
#else
    proc.start("./server/server");
#endif
    QVERIFY(proc.waitForStarted());

    QTestEventLoop::instance().enterLoop(5);
    QVERIFY(con.interface()->isServiceRegistered(serviceName));

    remote = new QDBusInterface(serviceName, "/", "com.trolltech.autotests.Performance", con, this);
    QVERIFY(remote->isValid());

    new ServerObject("/", con, this);
    local = new QDBusInterface(con.baseService(), "/", "com.trolltech.autotests.Performance", con, this);
    QVERIFY(local->isValid());
}
Exemple #6
0
void quitApplicationsOverDBus()
{
    QDBusConnection connection = QDBusConnection::sessionBus();
    QDBusConnectionInterface *bus = connection.interface();
    const QStringList services = bus->registeredServiceNames();
    foreach (const QString &service, services) {
        if (service.startsWith(QLatin1String("org.freedesktop.DBus")) || service.startsWith(QLatin1Char(':'))) {
            continue;
        }
        QDBusInterface *iface = new QDBusInterface(service,
                QLatin1String("/MainApplication"),
                QLatin1String("org.kde.KApplication"),
                connection);
        if (!iface->isValid()) {
            if (verbose) {
                fprintf(stderr, "invalid interface of service %s\n", service.toLatin1().data());
            }
            continue;
        }
        iface->call("quit");
        if (iface->lastError().isValid()) {
            if (verbose) {
                fprintf(stderr, "killing %s with result\n", iface->lastError().message().toLatin1().data());
            }
        }
        delete iface;
    }
}
Exemple #7
0
 // ---------------------------------------------------------------------------------
 bool detail::service_to_register_with_dbus::at_system_bus()
 {
   QDBusConnection con = dbus().system_bus();
   if ( !con.isConnected() )
   {
     qWarning() << "not connected to system bus";
     return false;
   }
   if ( _M_op == REGISTER )
   {
     bool result = con.registerService ( _M_service );
     if ( result == false )
     {
       qDebug() << "something went wrong when trying to register the DBUS service: " << _M_service;
       qDebug() << con.lastError();
       return false;
     }
     return true;
   }
   else
   {
     if ( con.interface()->isServiceRegistered ( _M_service ) )
     {
       return con.unregisterService ( _M_service );
     }
   }
   return true;
 }
Exemple #8
0
void processSession(QString arg)
{
	QDBusConnection conn = QDBusConnection::sessionBus();
	QDBusConnectionInterface* bus = conn.interface();
	
	if(bus->isServiceRegistered("info.dolezel.fatrat"))
	{
		qDebug() << "FatRat is already running";
		
		if(!arg.isEmpty())
		{
			qDebug() << "Passing arguments to an existing instance.";
			QDBusInterface iface("info.dolezel.fatrat", "/", "info.dolezel.fatrat", conn);
			
			iface.call("addTransfers", arg);
		}
		else
		{
			QMessageBox::critical(0, "FatRat", QObject::tr("There is already a running instance.\n"
					"If you want to start FatRat anyway, pass --force among arguments."));
		}
		
		exit(0);
	}
}
Exemple #9
0
/**
 * Returns whether the running Desktop only supports one Mouse Button
 * Hint: Unity / Gnome only support one type of activation (left-click == right-click).
 */
bool KMixDockWidget::onlyHaveOneMouseButtonAction()
{
	QDBusConnection connection = QDBusConnection::sessionBus();
    bool unityIsRunning = (connection.interface()->isServiceRegistered("com.canonical.Unity.Panel.Service"));
    // Possibly implement other detectors, like for Gnome 3 or Gnome 2
    return unityIsRunning;

}
Exemple #10
0
Toutatis::Toutatis(QObject* parent)
: QObject(parent)
, d_ptr(new ToutatisPrivate)
{
    Q_D(Toutatis);
    qDebug() << "Creating a Toutatis";
    
    QDBusConnection dbus = QDBusConnection::sessionBus();
    if (!dbus.interface()->isServiceRegistered(Service))
    {
        dbus.interface()->startService(Service);
    }
    
    d->interface = new com::noughmad::Toutatis(Service, "/Toutatis", QDBusConnection::sessionBus(), this);
    
    connect(d->interface, SIGNAL(projectIdsChanged()), SLOT(updateProjects()));
    updateProjects();
}
static QDBusConnectionInterface *tryToInitDBusConnection()
{
    // Check the D-Bus connection health
    QDBusConnectionInterface *dbusService = 0;
    QDBusConnection sessionBus = QDBusConnection::sessionBus();
    if (!sessionBus.isConnected() || !(dbusService = sessionBus.interface())) {
        kError() << "KUniqueApplication: Cannot find the D-Bus session server: " << sessionBus.lastError().message() << endl;
        ::exit(255);
    }
    return dbusService;
}
/*!
    \class DBusConnection
    \internal
    \brief Connects to the accessibility dbus.

    This is usually a different bus from the session bus.
*/
DBusConnection::DBusConnection(QObject *parent)
    : QObject(parent), m_a11yConnection(QString()), m_enabled(false)
{
    // Start monitoring if "org.a11y.Bus" is registered as DBus service.
    QDBusConnection c = QDBusConnection::sessionBus();
    dbusWatcher = new QDBusServiceWatcher(A11Y_SERVICE, c, QDBusServiceWatcher::WatchForRegistration, this);
    connect(dbusWatcher, SIGNAL(serviceRegistered(QString)), this, SLOT(serviceRegistered()));

    // If it is registered already, setup a11y right away
    if (c.interface()->isServiceRegistered(A11Y_SERVICE))
        serviceRegistered();
}
Exemple #13
0
	void DBusAbstractAdaptor::handleDBusDisconnected(QDBusConnection const& connection) {
		// remove all matching and dead connections
		auto ci = connection.interface();
		std::list<QDBusConnection> removeCons;
		for (auto i = begin(m_connections), e = end(m_connections); i != e; ++i) {
			if (ci == i->interface() || !i->isConnected()) {
				removeCons.push_back(*i);
				i = m_connections.erase(i);
			}
		}
		removeConnections(std::move(removeCons));
	}
Exemple #14
0
void listAllNamedAppsInDBus()
{
    QDBusConnection connection = QDBusConnection::sessionBus();
    QDBusConnectionInterface *bus = connection.interface();
    const QStringList services = bus->registeredServiceNames();
    foreach (const QString &service, services) {
        if (service.startsWith(QLatin1String("org.freedesktop.DBus")) || service.startsWith(QLatin1Char(':'))) {
            continue;
        }
        fprintf(stderr, "%s \n", service.toLatin1().data());
    }
}
QTM_BEGIN_NAMESPACE

#if defined(BACKEND_NM)
static bool NetworkManagerAvailable()
{
    QDBusConnection dbusConnection = QDBusConnection::systemBus();
    if (dbusConnection.isConnected()) {
        QDBusConnectionInterface *dbiface = dbusConnection.interface();
        QDBusReply<bool> reply = dbiface->isServiceRegistered("org.freedesktop.NetworkManager");
        if (reply.isValid())
            return reply.value();
    }
    return false;
}
Exemple #16
0
int fcitxIsNotRunning()
{
    char* servicename = NULL;
    asprintf(&servicename, "%s-%d", FCITX_DBUS_SERVICE,
        fcitx_utils_get_display_number());

    QDBusConnection conn = QDBusConnection::sessionBus();
    if (!conn.isConnected())
        return -1;

    // ?? Always return false...
    //QDBusReply<boolean> reply = conn.interface()->call("NameHasOwner", servicename);
    QDBusReply<QString> reply = conn.interface()->call("GetNameOwner", servicename);

    qDebug() << "reply.value():" << reply.value();
    return reply.value() == "";
}
void KDEDKSysGuard::showTaskManager()
{
    QDBusConnection con = QDBusConnection::sessionBus();
    QDBusConnectionInterface* interface = con.interface();
    if (interface->isServiceRegistered(QStringLiteral("org.kde.systemmonitor"))) {
        QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.systemmonitor"),
                                                          QStringLiteral("/"),
                                                          QStringLiteral("org.qtproject.Qt.QWidget"),
                                                          QStringLiteral("close"));

        con.asyncCall(msg);
    }
    else {
        QString exe = QStandardPaths::findExecutable(QStringLiteral("systemmonitor"));
        QProcess::startDetached(exe);
    }
}
Exemple #18
0
 // ---------------------------------------------------------------------------------
 bool detail::service_to_register_with_dbus::at_session_bus()
 {
   QDBusConnection con = dbus().session_bus();
   if ( !con.isConnected() )
   {
     qWarning() << "not connected to session bus";
     return false;
   }
   if ( _M_op == REGISTER )
   {
     return con.registerService ( _M_service );
   }
   if ( con.interface()->isServiceRegistered ( _M_service ) )
   {
     return con.unregisterService ( _M_service );
   }
   return true;
 }
QString StatefulDBusProxy::uniqueNameFrom(const QDBusConnection &bus, const QString &name,
        QString &error, QString &message)
{
    if (name.startsWith(QLatin1String(":"))) {
        return name;
    }

    // For a stateful interface, it makes no sense to follow name-owner
    // changes, so we want to bind to the unique name.
    QDBusReply<QString> reply = bus.interface()->serviceOwner(name);
    if (reply.isValid()) {
        return reply.value();
    } else {
        error = reply.error().name();
        message = reply.error().message();
        return QString();
    }
}
void PowerDevilRunner::initUpdateTriggers()
{
    // Also receive updates triggered through the DBus
    QDBusConnection dbus = QDBusConnection::sessionBus();
    if (dbus.interface()->isServiceRegistered("org.kde.Solid.PowerManagement")) {
        if (!dbus.connect("org.kde.Solid.PowerManagement",
                          "/org/kde/Solid/PowerManagement",
                          "org.kde.Solid.PowerManagement",
                          "profileChanged", this, SLOT(updateStatus()))) {
            kDebug() << "error!";
        }
        if (!dbus.connect("org.kde.Solid.PowerManagement",
                          "/org/kde/Solid/PowerManagement",
                          "org.kde.Solid.PowerManagement",
                          "configurationReloaded", this, SLOT(updateStatus()))) {
            kDebug() << "error!";
        }
    }
}
void FcitxQtConnectionPrivate::createConnection() {
    if (m_connectedOnce && !m_autoReconnect) {
        return;
    }

    m_serviceWatcher->disconnect(SIGNAL(serviceOwnerChanged(QString,QString,QString)));
    QString addr = address();
    if (!addr.isNull()) {
        QDBusConnection connection(QDBusConnection::connectToBus(addr, "fcitx"));
        if (connection.isConnected()) {
            // qDebug() << "create private";
            m_connection = new QDBusConnection(connection);
        }
        else
            QDBusConnection::disconnectFromBus("fcitx");
    }

    if (!m_connection) {
        QDBusConnection* connection = new QDBusConnection(QDBusConnection::sessionBus());
        connect(m_serviceWatcher, &QDBusServiceWatcher::serviceOwnerChanged,
                this, &FcitxQtConnectionPrivate::imChanged);
        QDBusReply<bool> registered = connection->interface()->isServiceRegistered(m_serviceName);
        if (!registered.isValid() || !registered.value()) {
            delete connection;
        }
        else {
            m_connection = connection;
        }
    }

    Q_Q(FcitxQtConnection);
    if (m_connection) {

        m_connection->connect("org.freedesktop.DBus.Local",
                            "/org/freedesktop/DBus/Local",
                            "org.freedesktop.DBus.Local",
                            "Disconnected",
                            this,
                            SLOT (dbusDisconnected ()));
        m_connectedOnce = true;
        emit q->connected();
    }
}
/*!
    Publishes all slots on this object within subclasses of QtopiaAbstractService.
    This is typically called from a subclass constructor.
*/
void QtopiaAbstractService::publishAll()
{
#if defined(QTOPIA_DBUS_IPC)
    QDBusConnection dbc = QDBus::sessionBus();
    if (!dbc.isConnected()) {
        qWarning() << "Unable to connect to D-BUS:" << dbc.lastError();
        return;
    }

    qLog(Services) << "Registering service" << m_data->m_service;

    QDBusConnectionInterface *iface = dbc.interface();
    QString service = dbusInterface;
    service.append(".");
    service.append(m_data->m_service);
    if (iface->registerService(service) == QDBusConnectionInterface::ServiceNotRegistered) {
        qWarning() << "WARNING: could not request name" << service;
        return;
    }

    new QtopiaDBusAdaptor(this);
    QString path = dbusPathBase;
    path.append(m_data->m_service);
    dbc.registerObject(path, this, QDBusConnection::ExportNonScriptableSlots);
#else
    const QMetaObject *meta = metaObject();
    if ( !m_data->m_publishAllCalled ) {
        int count = meta->methodCount();
        int index = QtopiaAbstractService::staticMetaObject.methodCount();
        for ( ; index < count; ++index ) {
            QMetaMethod method = meta->method( index );
            if ( method.methodType() == QMetaMethod::Slot &&
                 method.access() == QMetaMethod::Public) {
                QByteArray name = method.signature();
                QtopiaIpcAdaptor::connect(m_data->m_copobject, "3" + name, this, "1" + name);
            }
        }
        m_data->m_publishAllCalled = true;
    }
#endif
}
Exemple #23
0
void DBusWinIdProvider::Private::tryRegister()
{
    // we don't care if we can't register or if we are replaced by the real tray
    // this is for fallback in case the tray app is not running
    QDBusConnection bus = QDBusConnection::sessionBus();
    QDBusConnectionInterface *busInterface = bus.interface();
    busInterface->registerService(QStringLiteral("org.freedesktop.akonaditray"),
                                  QDBusConnectionInterface::DontQueueService,
                                  QDBusConnectionInterface::AllowReplacement);

    if (!mObjectRegistered) {
        mObjectRegistered = bus.registerObject(QStringLiteral("/Actions"), q,
                                               QDBusConnection::ExportScriptableSlots);
        if (!mObjectRegistered) {
            qCWarning(FATCRM_CLIENT_LOG) << "Failed to register provider object /Actions";
        }
    }

    qCDebug(FATCRM_CLIENT_LOG) << "currentOwner="
             << busInterface->serviceOwner(QStringLiteral("org.freedesktop.akonaditray"));
}
Exemple #24
0
Window::Window(QWidget* parent)
    : QMainWindow(parent),
      m_playerActionGroup(new QActionGroup(this)),
      m_tabWidget(0),
      m_rootTest(0),
      m_rootWidget(0),
      m_playerTest(0),
      m_playerWidget(0),
      m_watcher(0)
{
    m_ui.setupUi(this);

    connect(m_ui.action_Quit, SIGNAL(triggered()),
            this, SLOT(close()));

    connect(m_playerActionGroup, SIGNAL(triggered(QAction*)),
            this, SLOT(changePlayer(QAction*)));

    m_timer.setInterval(2500);

    QDBusConnection sessionConn = QDBusConnection::sessionBus();
    if (sessionConn.isConnected()) {
        m_watcher = new QDBusServiceWatcher(QString(),
                                            sessionConn,
                                            QDBusServiceWatcher::WatchForOwnerChange,
                                            this);
        connect(m_watcher, SIGNAL(serviceOwnerChanged(QString,QString,QString)),
                this,  SLOT(serviceChange(QString,QString,QString)));

        QDBusConnectionInterface* bus = sessionConn.interface();

        QDBusReply<QStringList> reply = bus->registeredServiceNames();
        if (reply.isValid()) {
            QStringList services = reply.value();
            foreach (const QString& name, services) {
                if (name.startsWith(playerPrefix)) {
                    serviceChange(name, QString(), "dummy");
                }
            }
        } else {
Exemple #25
0
	void DBusAbstractAdaptor::handleDBusConnected(QDBusConnection const& connection) {
		// remove dead connections
		bool found = false;
		auto const ci = connection.interface();
		std::list<QDBusConnection> removeCons;
		for (auto i = begin(m_connections), e = end(m_connections); i != e; ++i) {
			found = found || (ci == i->interface());
			if (!i->isConnected()) {
				removeCons.push_back(*i);
				i = m_connections.erase(i);
			}
		}
		removeConnections(std::move(removeCons));

		if (found) {
			qWarning() << "Adaptor " << m_path.path() << " already registered on dbus connection";
			return;
		}
		m_connections.push_back(connection);

		auto c = connection; // registerService() doesn't work on const& -.-

		/* only add connection if we could register our own object */
		if (!c.registerObject(m_path.path(), parent())) {
			qWarning() << "registerObject(" << m_path.path() << ") failed";
			return;
		}

		for (auto s: m_services) {
			if (c.registerService(s.first)) {
				s.second.push_back(c);
			} else {
				qWarning() << "registerService(" << s.first << ") failed";
			}
		}

		onDBusConnected(c);
		emit m_signals.dbusConnected(connection);
	}
int main(int argc, char *argv[])
{
    setenv("USE_ASYNC", "1", 1);
    QQuickWindow::setDefaultAlphaBuffer(true);

    QScopedPointer<QGuiApplication> application(SailfishApp::application(argc, argv));
    application->setApplicationName("harbour-webpirate");

    pluginenv();
    ProxyManager::loadAndSet();

    QDBusConnection sessionbus = QDBusConnection::sessionBus();

    if(sessionbus.interface()->isServiceRegistered(WebPirateInterface::INTERFACE_NAME)) // Only a Single Instance is allowed
    {
        WebPirateInterface::sendArgs(application->arguments().mid(1)); // Forward URLs to the running instance

        if(application->hasPendingEvents())
            application->processEvents();

        return 0;
    }

    FilesModel::registerMetaTypes();

    qmlRegisterType<AbstractDownloadItem>("harbour.webpirate.Private", 1, 0, "DownloadItem");
    qmlRegisterType<FavoriteItem>("harbour.webpirate.Private", 1, 0, "FavoriteItem");
    qmlRegisterType<MimeDatabase>("harbour.webpirate.Private", 1, 0, "MimeDatabase");

    qmlRegisterType<TranslationInfoItem>("harbour.webpirate.Translation", 1, 0, "TranslationInfoItem");
    qmlRegisterType<TranslationsModel>("harbour.webpirate.Translation", 1, 0, "TranslationsModel");

    qmlRegisterSingletonType<AES256>("harbour.webpirate.Security", 1, 0, "AES256", &AES256::initialize);
    qmlRegisterSingletonType<NetworkInterfaces>("harbour.webpirate.Network", 1, 0, "NetworkInterfaces", &NetworkInterfaces::initialize);
    qmlRegisterSingletonType<MachineID>("harbour.webpirate.DBus", 1, 0, "MachineID", &MachineID::initialize);
    qmlRegisterSingletonType<Ofono>("harbour.webpirate.DBus", 1, 0, "Ofono", &Ofono::initialize);

    qmlRegisterType<DefaultBrowser>("harbour.webpirate.DBus", 1, 0, "DefaultBrowser");
    qmlRegisterType<WebPirateInterface>("harbour.webpirate.DBus", 1, 0, "WebPirateInterface");
    qmlRegisterType<ScreenBlank>("harbour.webpirate.DBus", 1, 0, "ScreenBlank");
    qmlRegisterType<UrlComposer>("harbour.webpirate.DBus", 1, 0, "UrlComposer");
    qmlRegisterType<NotificationManager>("harbour.webpirate.DBus.Notifications", 1, 0, "Notifications");
    qmlRegisterType<TransferEngine>("harbour.webpirate.DBus.TransferEngine", 1, 0, "TransferEngine");
    qmlRegisterType<TransferMethodModel>("harbour.webpirate.DBus.TransferEngine", 1, 0, "TransferMethodModel");
    qmlRegisterType<ProxyManager>("harbour.webpirate.Network", 1, 0, "ProxyManager");

    qmlRegisterType<AdBlockEditor>("harbour.webpirate.AdBlock", 1, 0, "AdBlockEditor");
    qmlRegisterType<AdBlockDownloader>("harbour.webpirate.AdBlock", 1, 0, "AdBlockDownloader");
    qmlRegisterType<AdBlockManager>("harbour.webpirate.AdBlock", 1, 0, "AdBlockManager");

    qmlRegisterType<CookieJar>("harbour.webpirate.WebKit", 1, 0, "CookieJar");
    qmlRegisterType<WebKitDatabase>("harbour.webpirate.WebKit", 1, 0, "WebKitDatabase");
    qmlRegisterType<WebIconDatabase>("harbour.webpirate.WebKit", 1, 0, "WebIconDatabase");
    qmlRegisterType<DownloadManager>("harbour.webpirate.WebKit", 1, 0, "DownloadManager");

    qmlRegisterType<ClipboardHelper>("harbour.webpirate.Helpers", 1, 0, "ClipboardHelper");
    qmlRegisterType<FilesModel>("harbour.webpirate.Selectors", 1, 0, "FilesModel");
    qmlRegisterType<FavoritesManager>("harbour.webpirate.LocalStorage", 1, 0, "FavoritesManager");

    QScopedPointer<QQuickView> view(SailfishApp::createView());
    QQmlEngine* engine = view->engine();
    QObject::connect(engine, SIGNAL(quit()), application.data(), SLOT(quit()));

    engine->addImageProvider(WebIconDatabase::PROVIDER_NAME, new FaviconProvider());
    view->setSource(SailfishApp::pathTo("qml/harbour-webpirate.qml"));
    view->show();

    return application->exec();
}