Skip to content

Commit

Permalink
check available wallets at startup
Browse files Browse the repository at this point in the history
  • Loading branch information
mhogomchungu committed Dec 9, 2024
1 parent 0f7b787 commit cc687bb
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 15 deletions.
24 changes: 13 additions & 11 deletions zuluCrypt-gui/favorites2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -818,10 +818,10 @@ void favorites2::walletOpts::setActive( favorites2 * m )
{
m_parent = m ;

if( m_set ){
this->setStatus() ;

if( !m_set ){

this->setStatus( m_status ) ;
}else{
this->getStatus() ;
}
}
Expand All @@ -836,10 +836,8 @@ void favorites2::walletOpts::checkAvaibale()
this->setActive( nullptr ) ;
}

void favorites2::walletOpts::setStatus( const favorites2::walletOpts::status& s )
void favorites2::walletOpts::setStatus()
{
m_status = s ;

if( m_parent ){

m_parent->m_ui->rbKWallet->setEnabled( m_status.m_kdeWallet ) ;
Expand All @@ -851,20 +849,24 @@ void favorites2::walletOpts::getStatus()
{
Task::run( [ & ](){

return favorites2::walletOpts::status( 0 ) ;
using wbe = LXQt::Wallet::BackEnd ;

} ).then( [ & ]( const favorites2::walletOpts::status& s ){
return LXQt::Wallet::backEndIsSupported( wbe::kwallet ) ;

} ).then( [ & ]( bool s ){

m_set = true ;

this->setStatus( s ) ;
m_status.m_kdeWallet = s ;

this->setStatus() ;
} ) ;
}

favorites2::walletOpts::status::status( int )
favorites2::walletOpts::status::status()
{
using wbe = LXQt::Wallet::BackEnd ;

m_gnomeWallet = LXQt::Wallet::backEndIsSupported( wbe::libsecret ) ;
m_kdeWallet = LXQt::Wallet::backEndIsSupported( wbe::kwallet ) ;
m_kdeWallet = false ;
}
18 changes: 14 additions & 4 deletions zuluCrypt-gui/favorites2.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,31 @@ class favorites2 : public QDialog
void setActive( favorites2 * ) ;
void setInactive() ;
void checkAvaibale() ;
template< typename Function >
void getAvailableWallets( const Function& function )
{
function( m_status.m_kdeWallet,m_status.m_gnomeWallet ) ;
}
private:
struct status
{
status() = default ;
status( int ) ;
status() ;
bool m_gnomeWallet ;
bool m_kdeWallet ;
} ;
void setStatus( const status& ) ;
void setStatus() ;
void getStatus() ;
bool m_set = false ;
status m_status ;
favorites2::walletOpts::status m_status ;
favorites2 * m_parent ;
} ;

template< typename Function >
static void getAvailableWallets( const Function& function )
{
m_walletOpts.getAvailableWallets( function ) ;
}

static void checkAvailableWallets() ;

class settings
Expand Down

0 comments on commit cc687bb

Please sign in to comment.