Skip to content

Commit

Permalink
silence cmake warnings + remove potential waiting for favorites windo…
Browse files Browse the repository at this point in the history
…ws to show up
  • Loading branch information
mhogomchungu committed Dec 3, 2024
1 parent aee4cdf commit dc29865
Show file tree
Hide file tree
Showing 10 changed files with 127 additions and 40 deletions.
46 changes: 31 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if(${CMAKE_VERSION} VERSION_GREATER "3.26")
cmake_minimum_required(VERSION 3.5.0)
cmake_minimum_required(VERSION 3.26.0)
else()
cmake_minimum_required(VERSION 3.0.2)
endif()
Expand All @@ -18,19 +18,19 @@ set( CMAKE_CXX_STANDARD 14 )
option(BUILD_WITH_QT6 "Build with Qt 6" OFF)

if(BUILD_WITH_QT6)
find_package(Qt6 COMPONENTS Core Widgets Network REQUIRED )
find_package(Qt6 COMPONENTS Core Widgets Network REQUIRED )
else()
find_package(Qt6 COMPONENTS Core QUIET)
find_package(Qt6 COMPONENTS Core QUIET)
if(Qt6_FOUND)
set(BUILD_WITH_QT6 ON)
set(BUILD_WITH_QT6 ON)
find_package(Qt6 COMPONENTS Core Widgets Network REQUIRED)
else()
find_package(Qt5 COMPONENTS Core QUIET)
find_package(Qt5 COMPONENTS Core QUIET)
if(Qt5_FOUND)
set(BUILD_WITH_QT6 OFF)
set(BUILD_WITH_QT6 OFF)
find_package(Qt5 COMPONENTS Core Widgets Network REQUIRED)
else()
message( FATAL_ERROR "-- Failed to find Qt5 or Qt6")
message( FATAL_ERROR "-- Failed to find Qt5 or Qt6")
endif()
endif()
endif()
Expand Down Expand Up @@ -241,19 +241,35 @@ else()

ADD_SUBDIRECTORY( src/3rdParty/lxqt_wallet )
else()
if( LXQT_WALLET_VERSION VERSION_GREATER "3.1.0" )
if(BUILD_WITH_QT6)

include_directories( ${LXQT_WALLET_INCLUDEDIR} )
link_directories( ${LXQT_WALLET_LIBDIR} )
if( LXQT_WALLET_VERSION VERSION_GREATER "4.0.1" )

message( STATUS "---------------------------------------------------------------------------" )
message( STATUS "lxqt wallet support will be provided by an external library" )
message( STATUS "---------------------------------------------------------------------------" )
include_directories( ${LXQT_WALLET_INCLUDEDIR} )
link_directories( ${LXQT_WALLET_LIBDIR} )

message( STATUS "---------------------------------------------------------------------------" )
message( STATUS "lxqt wallet support will be provided by an external library" )
message( STATUS "---------------------------------------------------------------------------" )
else()
message( STATUS "---------------------------------------------------------------------------" )

message( FATAL_ERROR "---------------------------------------------------------------------------\nInstalled version of lxqt_wallet is too old(<4.0.2)\nPlease install a more receant version from: https://github.com/lxqt/lxqt_wallet\n---------------------------------------------------------------------------" )
endif()
else()
message( STATUS "---------------------------------------------------------------------------" )
if( LXQT_WALLET_VERSION VERSION_GREATER "3.1.0" )

include_directories( ${LXQT_WALLET_INCLUDEDIR} )
link_directories( ${LXQT_WALLET_LIBDIR} )

message( FATAL_ERROR "---------------------------------------------------------------------------\nInstalled version of lxqt_wallet is too old(<3.2.0)\nPlease install a more receant version from: https://github.com/lxqt/lxqt_wallet\n---------------------------------------------------------------------------" )
message( STATUS "---------------------------------------------------------------------------" )
message( STATUS "lxqt wallet support will be provided by an external library" )
message( STATUS "---------------------------------------------------------------------------" )
else()
message( STATUS "---------------------------------------------------------------------------" )

message( FATAL_ERROR "---------------------------------------------------------------------------\nInstalled version of lxqt_wallet is too old(<3.2.0)\nPlease install a more receant version from: https://github.com/lxqt/lxqt_wallet\n---------------------------------------------------------------------------" )
endif()
endif()
endif()
endif()
Expand Down
2 changes: 1 addition & 1 deletion src/3rdParty/lxqt_wallet/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if(${CMAKE_VERSION} VERSION_GREATER "3.26")
cmake_minimum_required(VERSION 3.5.0)
cmake_minimum_required(VERSION 3.26.0)
else()
cmake_minimum_required(VERSION 3.0.2)
endif()
Expand Down
2 changes: 1 addition & 1 deletion src/3rdParty/lxqt_wallet/backend/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if(${CMAKE_VERSION} VERSION_GREATER "3.26")
cmake_minimum_required(VERSION 3.5.0)
cmake_minimum_required(VERSION 3.26.0)
else()
cmake_minimum_required(VERSION 3.0.0)
endif()
Expand Down
2 changes: 1 addition & 1 deletion src/3rdParty/lxqt_wallet/frontend/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if(${CMAKE_VERSION} VERSION_GREATER "3.26")
cmake_minimum_required(VERSION 3.5.0)
cmake_minimum_required(VERSION 3.26.0)
else()
cmake_minimum_required(VERSION 3.0.0)
endif()
Expand Down
2 changes: 1 addition & 1 deletion src/3rdParty/lxqt_wallet/frontend/libsecret/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if(${CMAKE_VERSION} VERSION_GREATER "3.26")
cmake_minimum_required(VERSION 3.5.0)
cmake_minimum_required(VERSION 3.26.0)
else()
cmake_minimum_required(VERSION 3.0.0)
endif()
Expand Down
3 changes: 1 addition & 2 deletions src/3rdParty/tasks/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if(${CMAKE_VERSION} VERSION_GREATER "3.26")
cmake_minimum_required(VERSION 3.5.0)
cmake_minimum_required(VERSION 3.26.0)
else()
cmake_minimum_required(VERSION 3.0.0)
endif()
Expand Down Expand Up @@ -32,7 +32,6 @@ else()
include_directories( ${Qt5Core_INCLUDE_DIRS} )
endif()


if( MCHUNGU_TASK_INSTALL )
add_library( mhogomchungu_task SHARED ${MOC_LIBRARY} )
set_target_properties(mhogomchungu_task PROPERTIES SOVERSION "${SO_VERSION}")
Expand Down
86 changes: 69 additions & 17 deletions src/favorites2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

const QString COMMENT = "-SiriKali_Comment_ID" ;

favorites2::walletOpts favorites2::m_walletOpts ;

QString favorites2::encodeKeyKeyFile( const QString& key,const QString& keyFile )
{
if( keyFile.isEmpty() ){
Expand Down Expand Up @@ -359,17 +361,11 @@ favorites2::favorites2( QWidget * parent,
using bk = LXQt::Wallet::BackEnd ;

m_ui->rbNone->setEnabled( true ) ;

auto _set_supported = []( QRadioButton * rb,LXQt::Wallet::BackEnd e ){

rb->setEnabled( LXQt::Wallet::backEndIsSupported( e ) ) ;
} ;

_set_supported( m_ui->rbInternalWallet,bk::internal ) ;
_set_supported( m_ui->rbKWallet,bk::kwallet ) ;
_set_supported( m_ui->rbLibSecret,bk::libsecret ) ;
_set_supported( m_ui->rbMacOSKeyChain,bk::osxkeychain ) ;
_set_supported( m_ui->rbWindowsDPAPI,bk::windows_dpapi ) ;
m_ui->rbKWallet->setEnabled( false ) ;
m_ui->rbLibSecret->setEnabled( false ) ;
m_ui->rbMacOSKeyChain->setEnabled( false ) ;
m_ui->rbWindowsDPAPI->setEnabled( false ) ;
m_ui->rbInternalWallet->setEnabled( LXQt::Wallet::backEndIsSupported( bk::libsecret ) ) ;

auto walletBk = m_settings.autoMountBackEnd() ;

Expand Down Expand Up @@ -516,7 +512,7 @@ favorites2::favorites2( QWidget * parent,
utility::setWindowsMountPointOptions( this,m_ui->lineEditMountPath,m_ui->pbMountPointPath ) ;
m_ui->labelMountPointPrefix->setText( tr( "Mount Point Path" ) ) ;
}else{
m_ui->pbMountPointPath->setIcon( QIcon( ":/icons/folder.png" ) ) ;
m_ui->pbMountPointPath->setIcon( QIcon( ":/icons/folder.png" ) ) ;

m_ui->labelMountPointPrefix->setText( tr( "Mount Point Prefix" ) ) ;

Expand Down Expand Up @@ -621,11 +617,11 @@ favorites2::favorites2( QWidget * parent,
} ) ;

m_ui->pbFolderPath->setIcon( QIcon( ":/sirikali.png" ) ) ;
m_ui->pbConfigFilePath->setIcon( QIcon( ":/icons/file.png" ) ) ;
m_ui->pbIdentityFile->setIcon( QIcon( ":/icons/file.png" ) ) ;
m_ui->pbAddToWallets->setIcon( QIcon( ":/icons/lock.png" ) ) ;
m_ui->pbConfigFilePath->setIcon( QIcon( ":/icons/file.png" ) ) ;
m_ui->pbIdentityFile->setIcon( QIcon( ":/icons/file.png" ) ) ;
m_ui->pbAddToWallets->setIcon( QIcon( ":/icons/lock.png" ) ) ;

QIcon exeIcon( ":/icons/executable.png" ) ;
QIcon exeIcon( ":/icons/executable.png" ) ;

m_ui->pbPreMount->setIcon( exeIcon ) ;
m_ui->pbPostMount->setIcon( exeIcon ) ;
Expand Down Expand Up @@ -663,6 +659,8 @@ favorites2::favorites2( QWidget * parent,
m_ui->pbOptions->setMenu( optionsMenu ) ;

this->ShowUI() ;

m_walletOpts.setActive( this ) ;
}

void favorites2::setMenu( QMenu& m )
Expand Down Expand Up @@ -718,6 +716,8 @@ void favorites2::setMenu( QMenu& m )

favorites2::~favorites2()
{
m_walletOpts.setInactive() ;

delete m_ui ;
}

Expand Down Expand Up @@ -1732,7 +1732,7 @@ void favorites2::setDefaultUI( const engines::engine& engine )
}
}

m_ui->pbFolderPath->setIcon( QIcon( ":/icons/folder.png" ) ) ;
m_ui->pbFolderPath->setIcon( QIcon( ":/icons/folder.png" ) ) ;
m_ui->pbFolderPath->setObjectName( "FolderHandle" ) ;

m_ui->labelName ->setText( tr( "Encrypted Folder Path" ) ) ;
Expand Down Expand Up @@ -1791,3 +1791,55 @@ bool favorites2::eventFilter( QObject * watched,QEvent * event )
{
return utility::eventFilter( this,watched,event,[ this ](){ this->HideUI() ; } ) ;
}

favorites2::walletOpts::walletOpts()
{
}

void favorites2::walletOpts::setActive( favorites2 * m )
{
m_parent = m ;
m_active = true ;

if( m_set ){

this->setOptions() ;
}else{
this->getOptions() ;
}
}

void favorites2::walletOpts::setInactive()
{
m_active = false ;
}

void favorites2::walletOpts::setOptions()
{
if( m_active ){

m_parent->m_ui->rbKWallet->setEnabled( m_kdeWallet ) ;
m_parent->m_ui->rbLibSecret->setEnabled( m_gnomeWallet ) ;
m_parent->m_ui->rbMacOSKeyChain->setEnabled( m_osxkeychain ) ;
m_parent->m_ui->rbWindowsDPAPI->setEnabled( m_windows_dpapi ) ;
}
}

void favorites2::walletOpts::getOptions()
{
Task::run( [ & ](){

using wbe = LXQt::Wallet::BackEnd ;

m_gnomeWallet = LXQt::Wallet::backEndIsSupported( wbe::libsecret ) ;
m_kdeWallet = LXQt::Wallet::backEndIsSupported( wbe::kwallet ) ;
m_osxkeychain = LXQt::Wallet::backEndIsSupported( wbe::osxkeychain ) ;
m_windows_dpapi = LXQt::Wallet::backEndIsSupported( wbe::windows_dpapi ) ;

m_set = true ;

} ).then( [ & ](){

this->setOptions() ;
} ) ;
}
20 changes: 20 additions & 0 deletions src/favorites2.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,26 @@ class favorites2 : public QDialog
{
Q_OBJECT
public:
class walletOpts
{
public:
walletOpts() ;
void setActive( favorites2 * ) ;
void setInactive() ;
private:
void setOptions() ;
void getOptions() ;
bool m_gnomeWallet = false ;
bool m_kdeWallet = false ;
bool m_osxkeychain = false ;
bool m_windows_dpapi = false ;
std::atomic_bool m_active{ false } ;
bool m_set = false ;
favorites2 * m_parent ;
} ;

static walletOpts m_walletOpts ;

static QString encodeKeyKeyFile( const QString&,const QString& ) ;
class credentials
{
Expand Down
2 changes: 1 addition & 1 deletion src/sirikali.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1762,7 +1762,7 @@ void sirikali::setUpFont()
{
}

void sirikali::closeEvent( QCloseEvent * e )
void sirikali::closeEvent( QCloseEvent * )
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/siripolkit/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if(${CMAKE_VERSION} VERSION_GREATER "3.26")
cmake_minimum_required(VERSION 3.5.0)
cmake_minimum_required(VERSION 3.26.0)
else()
cmake_minimum_required(VERSION 3.0.0)
endif()
Expand Down

0 comments on commit dc29865

Please sign in to comment.