void ResourceAppointmentsView::setGuiActive( bool activate )
{
    kDebug(planDbg())<<activate;
    updateActionsEnabled( true );
    ViewBase::setGuiActive( activate );
    if ( activate && !m_view->selectionModel()->currentIndex().isValid() ) {
        m_view->selectionModel()->setCurrentIndex(m_view->model()->index( 0, 0 ), QItemSelectionModel::NoUpdate);
    }
}
void ResourceAllocationEditor::setGuiActive( bool activate )
{
    debugPlan<<activate;
    updateActionsEnabled( true );
    ViewBase::setGuiActive( activate );
    if ( activate && !m_view->selectionModel()->currentIndex().isValid() ) {
        m_view->selectionModel()->setCurrentIndex(m_view->model()->index( 0, 0 ), QItemSelectionModel::NoUpdate);
    }
}
void ResourceAllocationEditor::slotEnableActions( bool on )
{
    updateActionsEnabled( on );
}
void ResourceAllocationEditor::slotSelectionChanged( const QModelIndexList& )
{
    //debugPlan<<list.count();
    updateActionsEnabled();
}
void ResourceAppointmentsView::slotEnableActions( bool on )
{
    updateActionsEnabled( on );
}
void ResourceAppointmentsView::slotSelectionChanged( const QModelIndexList& )
{
    //debugPlan<<list.count();
    updateActionsEnabled();
}
Esempio n. 7
0
void HtmlView::slotEnableActions( bool on )
{
    updateActionsEnabled( on );
}
Esempio n. 8
0
void RelationEditor::slotEnableActions()
{
    updateActionsEnabled( true );
}
Esempio n. 9
0
void BackendOSM::slotHTMLEvents(const QStringList& events)
{
    // for some events, we just note that they appeared and then process them later on:
    bool centerProbablyChanged    = false;
    bool mapTypeChanged           = false;
    bool zoomProbablyChanged      = false;
    bool mapBoundsProbablyChanged = false;
    QIntList movedClusters;
    QList<QPersistentModelIndex> movedMarkers;

    for (QStringList::const_iterator it = events.constBegin(); it != events.constEnd(); ++it)
    {
        const QString eventCode           = it->left(2);
        const QString eventParameter      = it->mid(2);
        const QStringList eventParameters = eventParameter.split(QLatin1Char( '/' ));

        if (eventCode == "MB")
        {   // NOTE: event currently disabled in javascript part
            // map bounds changed
            centerProbablyChanged    = true;
            zoomProbablyChanged      = true;
            mapBoundsProbablyChanged = true;
        }
        else if (eventCode == "ZC")
        {   // NOTE: event currently disabled in javascript part
            // zoom changed
            zoomProbablyChanged      = true;
            mapBoundsProbablyChanged = true;
        }
        else if (eventCode == "id")
        {
            // idle after drastic map changes
            centerProbablyChanged    = true;
            zoomProbablyChanged      = true;
            mapBoundsProbablyChanged = true;
        }
        else if (eventCode == "cm")
        {
            // TODO: buffer this event type!
            // cluster moved
            bool okay              = false;
            const int clusterIndex = eventParameter.toInt(&okay);

            if (!okay)
                continue;

            if ((clusterIndex < 0) || (clusterIndex > s->clusterList.size()))
                continue;

            // re-read the marker position:
            GeoCoordinates clusterCoordinates;
            const bool isValid = d->htmlWidget->runScript2Coordinates(
                                     QString::fromLatin1("kgeomapGetClusterPosition(%1);").arg(clusterIndex),
                                     &clusterCoordinates);

            if (!isValid)
                continue;

            // TODO: this discards the altitude!
            s->clusterList[clusterIndex].coordinates = clusterCoordinates;

            movedClusters << clusterIndex;
        }
        else if (eventCode == "mm")
        {
            // TODO: buffer this event type!
            // marker moved
            bool okay           = false;
            const int markerRow = eventParameter.toInt(&okay);

            if (!okay)
                continue;

            if ((markerRow < 0) || (markerRow > s->specialMarkersModel->rowCount()))
                continue;

            // re-read the marker position:
            GeoCoordinates markerCoordinates;
            const bool isValid = d->htmlWidget->runScript2Coordinates(
                                     QString::fromLatin1("kgeomapGetMarkerPosition(%1);").arg(markerRow),
                                     &markerCoordinates
                                 );

            if (!isValid)
                continue;

            // TODO: this discards the altitude!
            const QModelIndex markerIndex = s->specialMarkersModel->index(markerRow, 0);
            s->specialMarkersModel->setData(markerIndex, QVariant::fromValue(markerCoordinates), s->specialMarkersCoordinatesRole);

            movedMarkers << QPersistentModelIndex(markerIndex);
        }
        else if (eventCode == "do")
        {
            // debug output:
            qCDebug(LIBKGEOMAP_LOG)<<QString::fromLatin1("javascript:%1").arg(eventParameter);
        }
    }

    if (!movedClusters.isEmpty())
    {
        qCDebug(LIBKGEOMAP_LOG) << movedClusters;
        emit(signalClustersMoved(movedClusters));
    }

    if (!movedMarkers.isEmpty())
    {
        qCDebug(LIBKGEOMAP_LOG) << movedMarkers;
        emit(signalSpecialMarkersMoved(movedMarkers));
    }

    // now process the buffered events:
    if (zoomProbablyChanged)
    {
        d->cacheZoom = d->htmlWidget->runScript(QLatin1String("kgeomapGetZoom();")).toInt();

        emit(signalZoomChanged(QString::fromLatin1("googlemaps:%1").arg(d->cacheZoom)));
    }
    if (centerProbablyChanged)
    {
        // there is nothing we can do if the coordinates are invalid
        /*const bool isValid = */d->htmlWidget->runScript2Coordinates("kgeomapGetCenter();", &(d->cacheCenter));
    }

    // update the actions if necessary:
    if (zoomProbablyChanged || mapTypeChanged || centerProbablyChanged)
    {
        updateActionsEnabled();
    }

    if (mapBoundsProbablyChanged)
    {
        const QString mapBoundsString = d->htmlWidget->runScript("kgeomapGetBounds();").toString();
        KGeoMapHelperParseBoundsString(mapBoundsString, &d->cacheBounds);
    }

    if (mapBoundsProbablyChanged || !movedClusters.isEmpty())
    {
        s->worldMapWidget->updateClusters();
    }
}