mirror of
https://github.com/OPM/ResInsight.git
synced 2026-11-02 20:30:46 -06:00
Add support for deleting OSDU and SUMO user token files (#11935)
* Add support for deleting OSDU and SUMO user token files
This commit is contained in:
1 parent
8822de0aee
commit
bb19ba75a4
16 files changed
+236
-2
No files matched your search
@@ -32,6 +32,9 @@
|
|||||||
#include "RiaQDateTimeTools.h"
|
#include "RiaQDateTimeTools.h"
|
||||||
#include "RiaValidRegExpValidator.h"
|
#include "RiaValidRegExpValidator.h"
|
||||||
|
|
||||||
|
#include "OsduCommands//RicDeleteOsduTokenFeature.h"
|
||||||
|
#include "Sumo/RicDeleteSumoTokenFeature.h"
|
||||||
|
|
||||||
#include "RiuGuiTheme.h"
|
#include "RiuGuiTheme.h"
|
||||||
|
|
||||||
#include "cafPdmFieldCvfColor.h"
|
#include "cafPdmFieldCvfColor.h"
|
||||||
@@ -42,6 +45,7 @@
|
|||||||
#include "cafPdmUiFieldHandle.h"
|
#include "cafPdmUiFieldHandle.h"
|
||||||
#include "cafPdmUiFilePathEditor.h"
|
#include "cafPdmUiFilePathEditor.h"
|
||||||
#include "cafPdmUiLineEditor.h"
|
#include "cafPdmUiLineEditor.h"
|
||||||
|
#include "cafPdmUiPushButtonEditor.h"
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
@@ -270,9 +274,15 @@ RiaPreferences::RiaPreferences()
|
|||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_osduPreferences, "osduPreferences", "osduPreferences" );
|
CAF_PDM_InitFieldNoDefault( &m_osduPreferences, "osduPreferences", "osduPreferences" );
|
||||||
m_osduPreferences = new RiaPreferencesOsdu;
|
m_osduPreferences = new RiaPreferencesOsdu;
|
||||||
|
CAF_PDM_InitField( &m_deleteOsduToken, "deleteOsduToken", false, "" );
|
||||||
|
caf::PdmUiPushButtonEditor::configureEditorLabelHidden( &m_deleteOsduToken );
|
||||||
|
m_deleteOsduToken.xmlCapability()->disableIO();
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_sumoPreferences, "sumoPreferences", "sumoPreferences" );
|
CAF_PDM_InitFieldNoDefault( &m_sumoPreferences, "sumoPreferences", "sumoPreferences" );
|
||||||
m_sumoPreferences = new RiaPreferencesSumo;
|
m_sumoPreferences = new RiaPreferencesSumo;
|
||||||
|
CAF_PDM_InitField( &m_deleteSumoToken, "deleteSumoToken", false, "" );
|
||||||
|
caf::PdmUiPushButtonEditor::configureEditorLabelHidden( &m_deleteSumoToken );
|
||||||
|
m_deleteSumoToken.xmlCapability()->disableIO();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -338,6 +348,14 @@ void RiaPreferences::defineEditorAttribute( const caf::PdmFieldHandle* field, QS
|
|||||||
myAttr->validator = new QDoubleValidator( 0.000001, 100000.0, 6 );
|
myAttr->validator = new QDoubleValidator( 0.000001, 100000.0, 6 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ( ( field == &m_deleteOsduToken ) || ( field == &m_deleteSumoToken ) )
|
||||||
|
{
|
||||||
|
auto* pbAttribute = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute );
|
||||||
|
if ( pbAttribute )
|
||||||
|
{
|
||||||
|
pbAttribute->m_buttonText = "Delete Token";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -476,10 +494,12 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
|
|||||||
caf::PdmUiGroup* osduGroup = uiOrdering.addNewGroup( "OSDU" );
|
caf::PdmUiGroup* osduGroup = uiOrdering.addNewGroup( "OSDU" );
|
||||||
osduGroup->setCollapsedByDefault();
|
osduGroup->setCollapsedByDefault();
|
||||||
m_osduPreferences()->uiOrdering( uiConfigName, *osduGroup );
|
m_osduPreferences()->uiOrdering( uiConfigName, *osduGroup );
|
||||||
|
osduGroup->add( &m_deleteOsduToken );
|
||||||
|
|
||||||
caf::PdmUiGroup* sumoGroup = uiOrdering.addNewGroup( "SUMO" );
|
caf::PdmUiGroup* sumoGroup = uiOrdering.addNewGroup( "SUMO" );
|
||||||
sumoGroup->setCollapsedByDefault();
|
sumoGroup->setCollapsedByDefault();
|
||||||
m_sumoPreferences()->uiOrdering( uiConfigName, *sumoGroup );
|
m_sumoPreferences()->uiOrdering( uiConfigName, *sumoGroup );
|
||||||
|
sumoGroup->add( &m_deleteSumoToken );
|
||||||
}
|
}
|
||||||
else if ( RiaApplication::enableDevelopmentFeatures() && uiConfigName == RiaPreferences::tabNameSystem() )
|
else if ( RiaApplication::enableDevelopmentFeatures() && uiConfigName == RiaPreferences::tabNameSystem() )
|
||||||
{
|
{
|
||||||
@@ -547,6 +567,16 @@ void RiaPreferences::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
|||||||
{
|
{
|
||||||
RiuGuiTheme::updateGuiTheme( m_guiTheme() );
|
RiuGuiTheme::updateGuiTheme( m_guiTheme() );
|
||||||
}
|
}
|
||||||
|
else if ( changedField == &m_deleteOsduToken )
|
||||||
|
{
|
||||||
|
RicDeleteOsduTokenFeature::deleteUserToken();
|
||||||
|
m_deleteOsduToken = false;
|
||||||
|
}
|
||||||
|
else if ( changedField == &m_deleteSumoToken )
|
||||||
|
{
|
||||||
|
RicDeleteSumoTokenFeature::deleteUserToken();
|
||||||
|
m_deleteSumoToken = false;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_summaryPreferences->fieldChangedByUi( changedField, oldValue, newValue );
|
m_summaryPreferences->fieldChangedByUi( changedField, oldValue, newValue );
|
||||||
|
|||||||
@@ -237,7 +237,11 @@ private:
|
|||||||
|
|
||||||
// Osdu settings
|
// Osdu settings
|
||||||
caf::PdmChildField<RiaPreferencesOsdu*> m_osduPreferences;
|
caf::PdmChildField<RiaPreferencesOsdu*> m_osduPreferences;
|
||||||
|
caf::PdmField<bool> m_deleteOsduToken;
|
||||||
|
|
||||||
|
// sumo settings
|
||||||
caf::PdmChildField<RiaPreferencesSumo*> m_sumoPreferences;
|
caf::PdmChildField<RiaPreferencesSumo*> m_sumoPreferences;
|
||||||
|
caf::PdmField<bool> m_deleteSumoToken;
|
||||||
|
|
||||||
// 3d view
|
// 3d view
|
||||||
caf::PdmField<caf::AppEnum<RiaDefines::MeshModeType>> m_defaultMeshModeType;
|
caf::PdmField<caf::AppEnum<RiaDefines::MeshModeType>> m_defaultMeshModeType;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ set(COMMAND_REFERENCED_CMAKE_FILES
|
|||||||
OctaveScriptCommands/CMakeLists_files.cmake
|
OctaveScriptCommands/CMakeLists_files.cmake
|
||||||
OperationsUsingObjReferences/CMakeLists_files.cmake
|
OperationsUsingObjReferences/CMakeLists_files.cmake
|
||||||
SummaryPlotCommands/CMakeLists_files.cmake
|
SummaryPlotCommands/CMakeLists_files.cmake
|
||||||
OsduImportCommands/CMakeLists_files.cmake
|
OsduCommands/CMakeLists_files.cmake
|
||||||
StreamlineCommands/CMakeLists_files.cmake
|
StreamlineCommands/CMakeLists_files.cmake
|
||||||
SurfaceCommands/CMakeLists_files.cmake
|
SurfaceCommands/CMakeLists_files.cmake
|
||||||
SeismicCommands/CMakeLists_files.cmake
|
SeismicCommands/CMakeLists_files.cmake
|
||||||
|
|||||||
+2
@@ -2,12 +2,14 @@ set(SOURCE_GROUP_HEADER_FILES
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/RicWellPathsImportOsduFeature.h
|
${CMAKE_CURRENT_LIST_DIR}/RicWellPathsImportOsduFeature.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RiuWellImportWizard.h
|
${CMAKE_CURRENT_LIST_DIR}/RiuWellImportWizard.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RiuWellLogImportWizard.h
|
${CMAKE_CURRENT_LIST_DIR}/RiuWellLogImportWizard.h
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RicDeleteOsduTokenFeature.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(SOURCE_GROUP_SOURCE_FILES
|
set(SOURCE_GROUP_SOURCE_FILES
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicWellPathsImportOsduFeature.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RicWellPathsImportOsduFeature.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RiuWellImportWizard.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RiuWellImportWizard.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RiuWellLogImportWizard.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RiuWellLogImportWizard.cpp
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RicDeleteOsduTokenFeature.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2024- Equinor ASA
|
||||||
|
//
|
||||||
|
// ResInsight is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
//
|
||||||
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "RicDeleteOsduTokenFeature.h"
|
||||||
|
|
||||||
|
#include "RiaDefines.h"
|
||||||
|
#include "RiaGuiApplication.h"
|
||||||
|
#include "RiaOsduDefines.h"
|
||||||
|
|
||||||
|
#include <QFile>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
CAF_CMD_SOURCE_INIT( RicDeleteOsduTokenFeature, "RicDeleteOsduTokenFeature" );
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicDeleteOsduTokenFeature::deleteUserToken()
|
||||||
|
{
|
||||||
|
const auto filename = RiaOsduDefines::tokenPath();
|
||||||
|
if ( !QFile::exists( filename ) ) return;
|
||||||
|
|
||||||
|
auto parent = RiaGuiApplication::instance()->activeWindow();
|
||||||
|
|
||||||
|
QString question = "Do you want to delete your OSDU token file?";
|
||||||
|
auto reply = QMessageBox::question( parent, "Delete token?", question, QMessageBox::Yes, QMessageBox::No );
|
||||||
|
if ( reply != QMessageBox::Yes ) return;
|
||||||
|
|
||||||
|
QFile::remove( filename );
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicDeleteOsduTokenFeature::onActionTriggered( bool isChecked )
|
||||||
|
{
|
||||||
|
deleteUserToken();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicDeleteOsduTokenFeature::setupActionLook( QAction* actionToSetup )
|
||||||
|
{
|
||||||
|
actionToSetup->setText( "Delete OSDU Token" + RiaDefines::betaFeaturePostfix() );
|
||||||
|
actionToSetup->setIcon( QIcon( ":/Cloud.svg" ) );
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2024- Equinor ASA
|
||||||
|
//
|
||||||
|
// ResInsight is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
//
|
||||||
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "cafCmdFeature.h"
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RicDeleteOsduTokenFeature : public caf::CmdFeature
|
||||||
|
{
|
||||||
|
CAF_CMD_HEADER_INIT;
|
||||||
|
|
||||||
|
static void deleteUserToken();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void onActionTriggered( bool isChecked ) override;
|
||||||
|
void setupActionLook( QAction* actionToSetup ) override;
|
||||||
|
};
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -31,7 +31,7 @@
|
|||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
#include "RimWellPathCollection.h"
|
#include "RimWellPathCollection.h"
|
||||||
|
|
||||||
#include "OsduImportCommands/RiuWellLogImportWizard.h"
|
#include "OsduCommands/RiuWellLogImportWizard.h"
|
||||||
#include "RiuMainWindow.h"
|
#include "RiuMainWindow.h"
|
||||||
|
|
||||||
#include "cafSelectionManager.h"
|
#include "cafSelectionManager.h"
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
set(SOURCE_GROUP_HEADER_FILES
|
set(SOURCE_GROUP_HEADER_FILES
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateSumoEnsembleFeature.h
|
${CMAKE_CURRENT_LIST_DIR}/RicCreateSumoEnsembleFeature.h
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RicDeleteSumoTokenFeature.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(SOURCE_GROUP_SOURCE_FILES
|
set(SOURCE_GROUP_SOURCE_FILES
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateSumoEnsembleFeature.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RicCreateSumoEnsembleFeature.cpp
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RicDeleteSumoTokenFeature.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2024- Equinor ASA
|
||||||
|
//
|
||||||
|
// ResInsight is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
//
|
||||||
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "RicDeleteSumoTokenFeature.h"
|
||||||
|
|
||||||
|
#include "RiaDefines.h"
|
||||||
|
#include "RiaGuiApplication.h"
|
||||||
|
#include "Tools/Cloud/RiaSumoDefines.h"
|
||||||
|
|
||||||
|
#include <QFile>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
CAF_CMD_SOURCE_INIT( RicDeleteSumoTokenFeature, "RicDeleteSumoTokenFeature" );
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicDeleteSumoTokenFeature::deleteUserToken()
|
||||||
|
{
|
||||||
|
const auto filename = RiaSumoDefines::tokenPath();
|
||||||
|
if ( !QFile::exists( filename ) ) return;
|
||||||
|
|
||||||
|
auto parent = RiaGuiApplication::instance()->activeWindow();
|
||||||
|
|
||||||
|
QString question = "Do you want to delete your SUMO token file?";
|
||||||
|
auto reply = QMessageBox::question( parent, "Delete token?", question, QMessageBox::Yes, QMessageBox::No );
|
||||||
|
if ( reply != QMessageBox::Yes ) return;
|
||||||
|
|
||||||
|
QFile::remove( filename );
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicDeleteSumoTokenFeature::onActionTriggered( bool isChecked )
|
||||||
|
{
|
||||||
|
deleteUserToken();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicDeleteSumoTokenFeature::setupActionLook( QAction* actionToSetup )
|
||||||
|
{
|
||||||
|
actionToSetup->setText( "Delete SUMO Token" + RiaDefines::betaFeaturePostfix() );
|
||||||
|
actionToSetup->setIcon( QIcon( ":/Cloud.svg" ) );
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2024- Equinor ASA
|
||||||
|
//
|
||||||
|
// ResInsight is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
//
|
||||||
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "cafCmdFeature.h"
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RicDeleteSumoTokenFeature : public caf::CmdFeature
|
||||||
|
{
|
||||||
|
CAF_CMD_HEADER_INIT;
|
||||||
|
|
||||||
|
static void deleteUserToken();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void onActionTriggered( bool isChecked ) override;
|
||||||
|
void setupActionLook( QAction* actionToSetup ) override;
|
||||||
|
};
|
||||||
Reference in new issue
Block a user