Skip to content

Commit

Permalink
revisit how volumes keys are accessed
Browse files Browse the repository at this point in the history
  • Loading branch information
mhogomchungu committed Sep 18, 2024
1 parent 207581f commit bf6df83
Show file tree
Hide file tree
Showing 12 changed files with 589 additions and 377 deletions.
3 changes: 2 additions & 1 deletion src/engines.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class engines
static QStringList executableSearchPaths() ;
static QStringList executableSearchPaths( const engines::engine& ) ;

class engineVersion{
class engineVersion
{
public:
engineVersion() ;
engineVersion( int major,int minor,int patch ) ;
Expand Down
59 changes: 45 additions & 14 deletions src/favorites2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ favorites2::favorites2( QWidget * parent,

this->hide() ;

m_secrets.changeInternalWalletPassword( a,b,[ this ]( bool s ){
m_secrets.changeInternalWalletPassword( this,a,b,[ this ]( bool s ){

if( s ){

Expand All @@ -608,7 +608,7 @@ favorites2::favorites2( QWidget * parent,

this->hide() ;

m_secrets.changeWindowsDPAPIWalletPassword( a,b,[ this ]( bool s ){
m_secrets.changeWindowsDPAPIWalletPassword( this,a,b,[ this ]( bool s ){

if( s ){

Expand Down Expand Up @@ -880,29 +880,60 @@ void favorites2::walletBkChanged( LXQt::Wallet::BackEnd bk )

m_wallet = m_secrets.walletBk( bk ) ;

m_wallet.open( [ this ](){
class meaw
{
public:
meaw( favorites2 * parent,LXQt::Wallet::BackEnd s ) :
m_parent( *parent ),
m_showAndHide( this->showAndHide( s ) )
{
}
void opened()
{
auto& m = *this ;

for( const auto& it : this->readAllKeys() ){
m( true ) ;
}
void before()
{
if( m_showAndHide ){

tablewidget::addRow( m_ui->tableWidgetWallet,{ it } ) ;
m_parent.hide() ;
}
}
void after()
{
}
void operator()( bool e )
{
if( e ){

},_hide_ui( [ this ](){ this->hide() ; },bk ),[ this ]( bool opened ){
for( const auto& it : m_parent.readAllKeys() ){

if( opened ){
tablewidget::addRow( m_parent.m_ui->tableWidgetWallet,{ it } ) ;
}
}else{
m_parent.m_ui->lineEditVolumePath->clear() ;

for( const auto& it : this->readAllKeys() ){
m_parent.setControlsAvailability( false,true ) ;
}
if( m_showAndHide ){

tablewidget::addRow( m_ui->tableWidgetWallet,{ it } ) ;
m_parent.show() ;
}
}else{
m_ui->lineEditVolumePath->clear() ;
}
private:
bool showAndHide( LXQt::Wallet::BackEnd m )
{
using bk = LXQt::Wallet::BackEnd ;

this->setControlsAvailability( false,true ) ;
return m == bk::internal || m == bk::windows_dpapi ;
}
favorites2& m_parent ;
bool m_showAndHide ;
} ;

this->show() ;
} ) ;
m_wallet.open( meaw( this,bk ) ) ;
}

void favorites2::setControlsAvailability( bool e,bool m )
Expand Down
8 changes: 4 additions & 4 deletions src/favorites2.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private :
void setMenu( QMenu& ) ;
void folderPath( void ) ;
void filePath( void ) ;
void mountPointPath( void ) ;
void mountPointPath() ;
void currentItemChanged( QTableWidgetItem * current,QTableWidgetItem * previous ) ;
void itemClicked( QTableWidgetItem * current,bool ) ;
void itemClicked( QTableWidgetItem * current ) ;
Expand All @@ -128,7 +128,7 @@ private :
void setVolumeProperties( utility2::result_ref< const favorites::entry& > e ) ;
void clearVolumeProperties() ;
void ShowUI() ;
void HideUI( void ) ;
void HideUI() ;
void checkFavoritesConsistency() ;
void setUiLikeSsh( const QString& cipherPath,const engines::engine& engine ) ;
void setDefaultUI( const engines::engine& ) ;
Expand All @@ -154,8 +154,8 @@ private :
QString m_cipherPath ;
QString m_keyFilePath ;

class wallet{

class wallet
{
public:
void operator=( secrets::wallet s )
{
Expand Down
Loading

0 comments on commit bf6df83

Please sign in to comment.