"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "zuluCrypt-gui/password_dialog.cpp" between
zuluCrypt-5.7.0.tar.xz and zuluCrypt-5.7.1.tar.xz

About: zuluCrypt is a simple but feature rich solution for hard drives encryption. It can manage PLAIN dm-crypt, LUKS, TrueCrypt and VeraCrypt encrypted volumes.

password_dialog.cpp  (zuluCrypt-5.7.0.tar.xz):password_dialog.cpp  (zuluCrypt-5.7.1.tar.xz)
skipping to change at line 23 skipping to change at line 23
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "password_dialog.h" #include "password_dialog.h"
#include "zulucrypt.h" #include "zulucrypt.h"
#include "lxqt_wallet.h" #include "lxqt_wallet.h"
#include "../plugin_path.h"
#include <QMenu> #include <QMenu>
#include <Qt> #include <Qt>
#include <QObject> #include <QObject>
#include <QFileDialog> #include <QFileDialog>
#include <QDir> #include <QDir>
#include <iostream> #include <iostream>
#include <QRadioButton> #include <QRadioButton>
#include <QPushButton> #include <QPushButton>
#include <QMessageBox> #include <QMessageBox>
skipping to change at line 90 skipping to change at line 91
this->setFixedSize( this->size() ) ; this->setFixedSize( this->size() ) ;
this->setWindowFlags( Qt::Window | Qt::Dialog ) ; this->setWindowFlags( Qt::Window | Qt::Dialog ) ;
this->setFont( parent->font() ) ; this->setFont( parent->font() ) ;
this->setDefaultOpenMode() ; this->setDefaultOpenMode() ;
m_ui->cbShareMountPoint->setChecked( utility::mountWithSharedMountPoint() ) ; m_ui->cbShareMountPoint->setChecked( utility::mountWithSharedMountPoint() ) ;
m_ui->PushButtonMountPointPath->setIcon( QIcon( ":/folder.png" ) ) ; m_ui->PushButtonMountPointPath->setIcon( QIcon( ":/folder.png" ) ) ;
m_ui->pushButtonLuksExternalHeaderPath->setIcon( QIcon( ":/file.png" ) )
;
m_open_with_path = false ; m_open_with_path = false ;
m_table = table ; m_table = table ;
m_pluginMenu = new QMenu( this ) ; m_pluginMenu = new QMenu( this ) ;
m_pluginMenu->setFont( this->font() ) ; m_pluginMenu->setFont( this->font() ) ;
connect( m_ui->PushButtonCancel,SIGNAL( clicked() ),this,SLOT( HideUI() ) ) ; connect( m_ui->PushButtonCancel,SIGNAL( clicked() ),this,SLOT( HideUI() ) ) ;
connect( m_ui->PushButtonOpen,SIGNAL( clicked() ),this,SLOT( buttonOpenCl icked() ) ) ; connect( m_ui->PushButtonOpen,SIGNAL( clicked() ),this,SLOT( buttonOpenCl icked() ) ) ;
connect( m_ui->PushButtonMountPointPath,SIGNAL( clicked() ),this,SLOT( mo unt_point() ) ) ; connect( m_ui->PushButtonMountPointPath,SIGNAL( clicked() ),this,SLOT( mo unt_point() ) ) ;
skipping to change at line 153 skipping to change at line 156
for( const auto& it : s ){ for( const auto& it : s ){
m->addAction( it ) ; m->addAction( it ) ;
} }
} }
return m ; return m ;
}() ) ; }() ) ;
connect( m_ui->pushButtonLuksExternalHeaderPath,&QPushButton::clicked,[ t
his ](){
auto a = tr( "Select External LUKS Header File" ) ;
auto Z = QFileDialog::getOpenFileName( this,a,utility::homePath()
) ;
if( !Z.isEmpty() ){
m_ui->lineEditVolumeProperty->setText( Z ) ;
}
} ) ;
m_ui->checkBoxVisibleKey->setToolTip( tr( "Check This Box To Make Passwor d Visible" ) ) ; m_ui->checkBoxVisibleKey->setToolTip( tr( "Check This Box To Make Passwor d Visible" ) ) ;
this->setWindowTitle( tr( "Unlock Encrypted Volume" ) ) ; this->setWindowTitle( tr( "Unlock Encrypted Volume" ) ) ;
this->installEventFilter( this ) ; this->installEventFilter( this ) ;
} }
void passwordDialog::plainDmCryptOption( QAction * ac ) void passwordDialog::plainDmCryptOption( QAction * ac )
{ {
m_plainDmCryptProperty = ac->text().remove( "&" ) ; m_plainDmCryptProperty = ac->text().remove( "&" ) ;
skipping to change at line 176 skipping to change at line 191
{ {
m_ui->lineEditVolumeProperty->clear() ; m_ui->lineEditVolumeProperty->clear() ;
m_ui->lineEditVolumeProperty->setToolTip( QString() ) ; m_ui->lineEditVolumeProperty->setToolTip( QString() ) ;
if( e == 0 ){ if( e == 0 ){
/* /*
* LUKS,TrueCrypt,BitLocker * LUKS,TrueCrypt,BitLocker
*/ */
m_ui->labelVolumeProperty->clear() ; m_ui->labelVolumeProperty->setText( tr( "LUKS External Header Pat
m_ui->lineEditVolumeProperty->setEnabled( false ) ; h" ) ) ;
m_ui->lineEditVolumeProperty->setEnabled( true ) ;
m_ui->pushButtonPlainDmCryptOptions->setEnabled( false ) ; m_ui->pushButtonPlainDmCryptOptions->setEnabled( false ) ;
m_veraCryptVolume = false ; m_veraCryptVolume = false ;
m_ui->pushButtonLuksExternalHeaderPath->setEnabled( true ) ;
m_ui->lineEditVolumeProperty->setEchoMode( QLineEdit::Normal ) ;
}else if( e == 1 || e == 2 ){ }else if( e == 1 || e == 2 ){
/* /*
* VeraCrypt volume * VeraCrypt volume
*/ */
m_ui->labelVolumeProperty->setText( tr( "PIM Value" ) ) ; m_ui->labelVolumeProperty->setText( tr( "PIM Value" ) ) ;
m_ui->lineEditVolumeProperty->setEnabled( true ) ; m_ui->lineEditVolumeProperty->setEnabled( true ) ;
m_ui->pushButtonPlainDmCryptOptions->setEnabled( false ) ; m_ui->pushButtonPlainDmCryptOptions->setEnabled( false ) ;
m_veraCryptVolume = true ; m_veraCryptVolume = true ;
m_ui->pushButtonLuksExternalHeaderPath->setEnabled( false ) ;
m_ui->lineEditVolumeProperty->setEchoMode( QLineEdit::Password )
;
}else if( e == 3 ){ }else if( e == 3 ){
/* /*
* PLAIN dm-crypt * PLAIN dm-crypt
*/ */
m_ui->pushButtonPlainDmCryptOptions->setEnabled( true ) ; m_ui->pushButtonPlainDmCryptOptions->setEnabled( true ) ;
m_ui->labelVolumeProperty->setText( tr( "Offset" ) ) ; m_ui->labelVolumeProperty->setText( tr( "Offset" ) ) ;
m_ui->lineEditVolumeProperty->setEnabled( true ) ; m_ui->lineEditVolumeProperty->setEnabled( true ) ;
m_ui->lineEditVolumeProperty->setToolTip( tr( "Offset Will Be In Sectors If The Entry Is Made Up Of Only Digits\nAnd In Bytes If The Entry Ends W ith \"b\"\nAnd In Kilobytes If The Entry Ends With \"k\"\nAnd In Megabytes If Th e Entry Ends With \"m\"\nAnd In Terabytes If The Entry Ends With \"t\"" ) ) ; m_ui->lineEditVolumeProperty->setToolTip( tr( "Offset Will Be In Sectors If The Entry Is Made Up Of Only Digits\nAnd In Bytes If The Entry Ends W ith \"b\"\nAnd In Kilobytes If The Entry Ends With \"k\"\nAnd In Megabytes If Th e Entry Ends With \"m\"\nAnd In Terabytes If The Entry Ends With \"t\"" ) ) ;
m_veraCryptVolume = false ; m_veraCryptVolume = false ;
m_ui->pushButtonLuksExternalHeaderPath->setEnabled( false ) ;
m_ui->lineEditVolumeProperty->setEchoMode( QLineEdit::Password )
;
} }
utility::defaultUnlockingVolumeType( e ) ; utility::defaultUnlockingVolumeType( e ) ;
} }
bool passwordDialog::eventFilter( QObject * watched,QEvent * event ) bool passwordDialog::eventFilter( QObject * watched,QEvent * event )
{ {
return utility::eventFilter( this,watched,event,[ this ](){ this->HideUI( ) ; } ) ; return utility::eventFilter( this,watched,event,[ this ](){ this->HideUI( ) ; } ) ;
} }
void passwordDialog::pbPlugin() void passwordDialog::pbPlugin()
{ {
//utility::createPlugInMenu( m_pluginMenu,tr( INTERNAL_WALLET ),
// tr( GNOME_WALLET ),tr( KWALLET ),!utility::use
ZuluPolkit() ) ;
utility::createPlugInMenu( m_pluginMenu,tr( INTERNAL_WALLET ), utility::createPlugInMenu( m_pluginMenu,tr( INTERNAL_WALLET ),
tr( GNOME_WALLET ),tr( KWALLET ),!utility::use ZuluPolkit() ) ; tr( GNOME_WALLET ),tr( KWALLET ),true ) ;
m_pluginMenu->addSeparator() ; m_pluginMenu->addSeparator() ;
m_pluginMenu->addAction( tr( "Cancel" ) ) ; m_pluginMenu->addAction( tr( "Cancel" ) ) ;
connect( m_pluginMenu,SIGNAL( triggered( QAction * ) ),this,SLOT( pbPlugi nEntryClicked( QAction * ) ) ) ; connect( m_pluginMenu,SIGNAL( triggered( QAction * ) ),this,SLOT( pbPlugi nEntryClicked( QAction * ) ) ) ;
m_pluginMenu->exec( QCursor::pos() ) ; m_pluginMenu->exec( QCursor::pos() ) ;
} }
skipping to change at line 619 skipping to change at line 643
m_ui->OpenVolumePath->setEnabled( false ) ; m_ui->OpenVolumePath->setEnabled( false ) ;
m_ui->PassPhraseField->setEnabled( false ) ; m_ui->PassPhraseField->setEnabled( false ) ;
m_ui->PushButtonCancel->setEnabled( false ) ; m_ui->PushButtonCancel->setEnabled( false ) ;
m_ui->PushButtonMountPointPath->setEnabled( false ) ; m_ui->PushButtonMountPointPath->setEnabled( false ) ;
m_ui->PushButtonOpen->setEnabled( false ) ; m_ui->PushButtonOpen->setEnabled( false ) ;
m_ui->pushButtonPassPhraseFromFile->setEnabled( false ) ; m_ui->pushButtonPassPhraseFromFile->setEnabled( false ) ;
m_ui->PushButtonVolumePath->setEnabled( false ) ; m_ui->PushButtonVolumePath->setEnabled( false ) ;
m_ui->pbKeyOption->setEnabled( false ) ; m_ui->pbKeyOption->setEnabled( false ) ;
m_ui->cbKeyType->setEnabled( false ) ; m_ui->cbKeyType->setEnabled( false ) ;
m_ui->checkBoxVisibleKey->setEnabled( false ) ; m_ui->checkBoxVisibleKey->setEnabled( false ) ;
m_ui->lineEditVolumeProperty->setEnabled( false ) ;
m_ui->labelVolumeProperty->setEnabled( false ) ;
m_ui->pushButtonLuksExternalHeaderPath->setEnabled( false ) ;
} }
void passwordDialog::enableAll() void passwordDialog::enableAll()
{ {
auto index = m_ui->cbVolumeType->currentIndex() ; auto index = m_ui->cbVolumeType->currentIndex() ;
m_ui->labelVolumeProperty->setEnabled( index != 0 ) ; if( index == 0 ){
m_ui->lineEditVolumeProperty->setEnabled( index != 0 ) ;
m_ui->pushButtonLuksExternalHeaderPath->setEnabled( true ) ;
}
m_ui->lineEditVolumeProperty->setEnabled( true ) ;
m_ui->labelVolumeProperty->setEnabled( true ) ;
m_ui->pushButtonPlainDmCryptOptions->setEnabled( index == 3 ) ; m_ui->pushButtonPlainDmCryptOptions->setEnabled( index == 3 ) ;
m_ui->cbVolumeType->setEnabled( true ) ; m_ui->cbVolumeType->setEnabled( true ) ;
m_ui->labelVolumeType->setEnabled( true ) ; m_ui->labelVolumeType->setEnabled( true ) ;
m_ui->cbShareMountPoint->setEnabled( true ) ; m_ui->cbShareMountPoint->setEnabled( true ) ;
m_ui->checkBoxReadOnly->setEnabled( true ) ; m_ui->checkBoxReadOnly->setEnabled( true ) ;
m_ui->labelMoutPointPath->setEnabled( true ) ; m_ui->labelMoutPointPath->setEnabled( true ) ;
m_ui->labelPassphrase->setEnabled( true ) ; m_ui->labelPassphrase->setEnabled( true ) ;
m_ui->labelVolumePath->setEnabled( true ) ; m_ui->labelVolumePath->setEnabled( true ) ;
m_ui->MountPointPath->setEnabled( true ) ; m_ui->MountPointPath->setEnabled( true ) ;
m_ui->OpenVolumePath->setEnabled( true ) ; m_ui->OpenVolumePath->setEnabled( true ) ;
skipping to change at line 732 skipping to change at line 765
}else if( keySource == passwordDialog::plugin ){ }else if( keySource == passwordDialog::plugin ){
if( m_key.isEmpty() ){ if( m_key.isEmpty() ){
m_label.show( tr( "Atleast one required field is empty" ) ) ; m_label.show( tr( "Atleast one required field is empty" ) ) ;
return this->enableAll() ; return this->enableAll() ;
}else{ }else{
auto r = m_ui->PassPhraseField->text() ; auto r = m_ui->PassPhraseField->text() ;
if( r == tr( KWALLET ) || r == tr( INTERNAL_WALLET ) || r == tr( GNOME_WALLET ) ){ if( utility::equalsAtleastOne( r,tr( KWALLET ),tr( INTERN AL_WALLET ),tr( GNOME_WALLET ) ) ){
passtype = "-f" ; passtype = "-f" ;
keyPath = utility::keyPath() ; keyPath = utility::keyPath() ;
this->sendKey( keyPath ) ; this->sendKey( keyPath ) ;
}else if( r == "hmac" || r == "gpg" || r == "keykeyfile" ){ }else if( utility::equalsAtleastOne( r,"hmac","gpg","keyk eyfile" ) ){
if( utility::pluginKey( m_secrets.parent(),&m_key ,r ) ){ if( utility::pluginKey( m_secrets.parent(),&m_key ,r ) ){
return this->enableAll() ; return this->enableAll() ;
}else{ }else{
passtype = "-f" ; passtype = "-f" ;
keyPath = utility::keyPath() ; keyPath = utility::keyPath() ;
this->sendKey( keyPath ) ; this->sendKey( keyPath ) ;
} }
skipping to change at line 788 skipping to change at line 821
this->sendKey( keyPath ) ; this->sendKey( keyPath ) ;
}else{ }else{
m_label.show( tr( "Failed to get a key from the network" ) ) ; m_label.show( tr( "Failed to get a key from the network" ) ) ;
m_ui->OpenVolumePath->setFocus() ; m_ui->OpenVolumePath->setFocus() ;
return this->enableAll() ; return this->enableAll() ;
} }
} }
}else{ }else{
passtype = "-G" ; auto env = QProcessEnvironment::systemEnvironment
keyPath = r ; () ;
env.insert( "zuluCryptPrintToStdOut","true" ) ;
m_key = Task::process::run( ZULUCRYPTpluginPath +
r,{},-1,"",env ).await().std_out() ;
if( m_key.isEmpty() ){
m_label.show( tr( "Failed to get a key fr
om a plugin" ) ) ;
m_ui->OpenVolumePath->setFocus() ;
return this->enableAll() ;
}else{
passtype = "-f" ;
keyPath = utility::keyPath() ;
this->sendKey( keyPath ) ;
}
} }
} }
}else if( keySource == passwordDialog::tcryptKeys ){ }else if( keySource == passwordDialog::tcryptKeys ){
passtype = "-f" ; passtype = "-f" ;
keyPath = utility::keyPath() ; keyPath = utility::keyPath() ;
this->sendKey( keyPath ) ; this->sendKey( keyPath ) ;
}else{ }else{
utility::debug() << "Error: uncaught condition" ; utility::debug() << "Error: uncaught condition" ;
skipping to change at line 823 skipping to change at line 871
auto s = utility::loopDevicePath( b ) ; auto s = utility::loopDevicePath( b ) ;
if( !s.isEmpty() ){ if( !s.isEmpty() ){
b = s ; b = s ;
} }
} }
auto exe = QString( "%1 -o -d \"%2\" -m \"%3\" -e %4 %5 \"%6\"" ).arg( a, b,c,d,e,f ) ; auto exe = QString( "%1 -o -d \"%2\" -m \"%3\" -e %4 %5 \"%6\"" ).arg( a, b,c,d,e,f ) ;
if( m_ui->cbVolumeType->currentIndex() == 0 ){
auto s = m_ui->lineEditVolumeProperty->text() ;
if( !s.isEmpty() ){
exe += " -z " + utility::Task::makePath( s ) ;
}
}
if( !m_keyFiles.isEmpty() ){ if( !m_keyFiles.isEmpty() ){
for( const auto& it : m_keyFiles ){ for( const auto& it : m_keyFiles ){
QString e = it ; QString e = it ;
e.replace( "\"","\"\"\"" ) ; e.replace( "\"","\"\"\"" ) ;
exe += " -F \"" + e + "\"" ; exe += " -F \"" + e + "\"" ;
} }
} }
 End of changes. 15 change blocks. 
9 lines changed or deleted 77 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)