~unity-team/unity-scopes-shell/overview

« back to all changes in this revision

Viewing changes to src/Unity/scope.cpp

  • Committer: Michal Hruby
  • Date: 2014-07-31 11:08:50 UTC
  • mfrom: (108.2.4 unity-scopes-shell)
  • Revision ID: michal.mhr@gmail.com-20140731110850-41qkf5s8x8ugm3bj
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
480
480
    m_scopesInstance = scopes;
481
481
    if (m_scopesInstance) {
482
482
        m_metadataConnection = QObject::connect(scopes, &Scopes::metadataRefreshed, this, &Scope::metadataRefreshed);
 
483
        m_locationService = m_scopesInstance->locationService();
 
484
        // TODO Notify the user the the location has changed
 
485
        // connect(m_locationService.data(), &LocationService::locationChanged, this, &Scope::invalidateResults);
483
486
    }
484
487
}
485
488
 
538
541
                meta["no-internet"] = true;
539
542
            }
540
543
        }
 
544
        try {
 
545
            // TODO Verify that the scope is allowed to access the location data
 
546
            if (m_scopeMetadata && m_scopeMetadata->location_data_needed())
 
547
            {
 
548
                meta.set_location(m_locationService->location());
 
549
            }
 
550
        }
 
551
        catch (std::domain_error& e)
 
552
        {
 
553
        }
541
554
        scopes::SearchListenerBase::SPtr listener(new SearchResultReceiver(this));
542
555
        m_searchController->setListener(listener);
543
556
        try {
752
765
        m_searchQuery = search_query;
753
766
 
754
767
        // FIXME: use a timeout
755
 
        dispatchSearch();
 
768
        invalidateResults();
756
769
 
757
770
        Q_EMIT searchQueryChanged();
758
771
    }
778
791
        m_isActive = active;
779
792
        Q_EMIT isActiveChanged();
780
793
 
 
794
        if (m_scopeMetadata && m_scopeMetadata->location_data_needed())
 
795
        {
 
796
            if (m_isActive)
 
797
            {
 
798
                m_locationService->activate();
 
799
            }
 
800
            else
 
801
            {
 
802
                m_locationService->deactivate();
 
803
            }
 
804
        }
 
805
 
781
806
        if (active && m_resultsDirty) {
782
807
            dispatchSearch();
783
808
        }