@@ -31,15 +31,13 @@ ActiveProject::ActiveProject( AppSettings &appSettings
3131 , ActiveLayer &activeLayer
3232 , LayersProxyModel &recordingLayerPM
3333 , LocalProjectsManager &localProjectsManager
34- , MerginApi *merginApi
3534 , QObject *parent ) :
3635
3736 QObject( parent )
3837 , mAppSettings( appSettings )
3938 , mActiveLayer( activeLayer )
4039 , mRecordingLayerPM( recordingLayerPM )
4140 , mLocalProjectsManager( localProjectsManager )
42- , mMerginApi( merginApi )
4341 , mProjectLoadingLog( " " )
4442{
4543 // we used to have our own QgsProject instance, but unfortunately few pieces of qgis_core
@@ -76,24 +74,6 @@ ActiveProject::ActiveProject( AppSettings &appSettings
7674 setAutosyncEnabled ( mAppSettings .autosyncAllowed () );
7775
7876 QObject::connect ( &mAppSettings , &AppSettings::autosyncAllowedChanged, this , &ActiveProject::setAutosyncEnabled );
79-
80- QObject::connect (
81- mMerginApi ,
82- &MerginApi::projectMetadataRoleUpdated,
83- this , [this ]( const QString & projectFullName, const QString & role )
84- {
85- if ( projectFullName == this ->projectFullName () )
86- {
87- setProjectRole ( role );
88- }
89- } );
90-
91- QObject::connect (
92- mMerginApi ,
93- &MerginApi::authChanged,
94- this ,
95- &ActiveProject::updateUserRoleInActiveProject
96- );
9777}
9878
9979ActiveProject::~ActiveProject () = default ;
@@ -204,11 +184,14 @@ bool ActiveProject::forceLoad( const QString &filePath, bool force )
204184 CoreUtils::log ( QStringLiteral ( " Project load" ), QStringLiteral ( " Could not find project in local projects: " ) + filePath );
205185 }
206186
187+ QString role = MerginProjectMetadata::fromCachedJson ( CoreUtils::getProjectMetadataPath ( mLocalProject .projectDir ) ).role ;
188+ qDebug () << " ROLE 1 : " << role;
189+ setProjectRole ( role );
190+
207191 updateMapTheme ();
208192 updateRecordingLayers ();
209193 updateActiveLayer ();
210194 updateMapSettingsLayers ();
211- updateUserRoleInActiveProject ();
212195
213196 emit localProjectChanged ( mLocalProject );
214197 emit projectReloaded ( mQgsProject );
@@ -589,9 +572,3 @@ void ActiveProject::setProjectRole( const QString &role )
589572 emit projectRoleChanged ();
590573 }
591574}
592-
593- void ActiveProject::updateUserRoleInActiveProject ()
594- {
595- // update user's role each time a project is opened or auth changes, following #3174
596- mMerginApi ->updateProjectMetadataRole ( projectFullName () );
597- }
0 commit comments