void BackendGoogleMaps::releaseWidget(KGeoMapInternalWidgetInfo* const info)
{
    // clear all tracks
    d->htmlWidget->runScript(QString::fromLatin1("kgeomapClearTracks();"));

    disconnect(d->htmlWidget, SIGNAL(signalJavaScriptReady()),
               this, SLOT(slotHTMLInitialized()));

    disconnect(d->htmlWidget, SIGNAL(signalHTMLEvents(QStringList)),
               this, SLOT(slotHTMLEvents(QStringList)));

    disconnect(d->htmlWidget, SIGNAL(selectionHasBeenMade(KGeoMap::GeoCoordinates::Pair)),
               this, SLOT(slotSelectionHasBeenMade(KGeoMap::GeoCoordinates::Pair)));

    d->htmlWidget->setSharedKGeoMapObject(0);
    d->htmlWidgetWrapper->removeEventFilter(this);

    d->htmlWidget        = 0;
    d->htmlWidgetWrapper = 0;
    info->currentOwner   = 0;
    info->state          = KGeoMapInternalWidgetInfo::InternalWidgetReleased;
    d->isReady           = false;

    emit(signalBackendReadyChanged(backendName()));
}
예제 #2
0
    ProjectInfo SQLitePlugin::initPrjDir(const QString& dir, const QString &) const
    {
        ProjectInfo prjInfo;
        prjInfo.backendName = backendName();
        prjInfo.databaseLocation = dir + QDir::separator() + "photo_broom.db";

        return prjInfo;
    }
예제 #3
0
void BackendOSM::slotHTMLInitialized()
{
    kDebug()<<1;
    d->isReady = true;
    d->htmlWidget->runScript(QLatin1String("document.getElementById(\"map_canvas\").style.height=\"%1px\"")
                             .arg(d->htmlWidgetWrapper->height()));

    // TODO: call javascript directly here and update action availability in one shot
    setCenter(d->cacheCenter);
    d->htmlWidget->runScript(QString::fromLatin1("kmapSetZoom(%1);").arg(d->cacheZoom));
    emit(signalBackendReady(backendName()));
}
void BackendGoogleMaps::slotHTMLInitialized()
{
    d->isReady = true;
    d->htmlWidget->runScript(QString::fromLatin1("kgeomapWidgetResized(%1, %2)").arg(d->htmlWidgetWrapper->width()).arg(d->htmlWidgetWrapper->height()));

    // TODO: call javascript directly here and update action availability in one shot
    setMapType(d->cacheMapType);
    setShowMapTypeControl(d->cacheShowMapTypeControl);
    setShowNavigationControl(d->cacheShowNavigationControl);
    setShowScaleControl(d->cacheShowNavigationControl);
    setCenter(d->cacheCenter);
    d->htmlWidget->runScript(QString::fromLatin1("kgeomapSetZoom(%1);").arg(d->cacheZoom));
    emit(signalBackendReadyChanged(backendName()));
}
void BackendGoogleMaps::setActive(const bool state)
{
    const bool oldState = d->activeState;
    d->activeState      = state;

    if (oldState != state)
    {
        if ((!state) && d->htmlWidgetWrapper)
        {
            // we should share our widget in the list of widgets in the global object
            KGeoMapInternalWidgetInfo info;
            info.deleteFunction = deleteInfoFunction;
            info.widget         = d->htmlWidgetWrapper.data();
            info.currentOwner   = this;
            info.backendName    = backendName();
            info.state          = d->widgetIsDocked ? KGeoMapInternalWidgetInfo::InternalWidgetStillDocked : KGeoMapInternalWidgetInfo::InternalWidgetUndocked;

            GMInternalWidgetInfo intInfo;
            intInfo.htmlWidget = d->htmlWidget.data();
            info.backendData.setValue(intInfo);

            KGeoMapGlobalObject* const go = KGeoMapGlobalObject::instance();
            go->addMyInternalWidgetToPool(info);
        }

        if (state && d->htmlWidgetWrapper)
        {
            // we should remove our widget from the list of widgets in the global object
            KGeoMapGlobalObject* const go = KGeoMapGlobalObject::instance();
            go->removeMyInternalWidgetFromPool(this);

            /// @todo re-cluster, update markers?
            setCenter(d->cacheCenter);
            setMapType(d->cacheMapType);
            setShowMapTypeControl(d->cacheShowMapTypeControl);
            setShowNavigationControl(d->cacheShowNavigationControl);
            setShowScaleControl(d->cacheShowScaleControl);

            /// @TODO update tracks more gently
            slotTracksChanged(d->trackChangeTracker);
            d->trackChangeTracker.clear();
        }
    }
}