void mountPartition::ShowUI( const volumeEntryProperties& e ) { m_path = e.volumeName() ; m_label = e.label() ; m_point = utility::mountPathPostFix( m_path.split( "/" ).last() ) ; m_ui->lineEdit->setText( m_point ) ; bool r = m_label != "Nil" ; m_ui->checkBox->setEnabled( r ) ; m_ui->checkBox->setChecked( r ) ; this->show() ; }
void MainWindow::mount( const volumeEntryProperties& entry ) { this->disableAll() ; if( entry.encryptedVolume() ){ keyDialog::instance( this,m_ui->tableWidget,entry,[ this ](){ this->enableAll() ; },[ this ]( const QString& e ){ this->openMountPointPath( e ) ; } )->ShowUI() ; }else{ mountPartition::instance( this,m_ui->tableWidget,[ this ](){ this->enableAll() ; },[ this ]( const QString& e ){ this->openMountPointPath( e ) ; } )->ShowUI( entry ) ; } }
void MainWindow::updateList( const volumeEntryProperties& entry ) { if( entry.isNotEmpty() ){ auto table = m_ui->tableWidget ; int row = tablewidget::columnHasEntry( table,entry.volumeName() ) ; if( row == -1 ){ row = tablewidget::addEmptyRow( table ) ; } if( entry.isSystem() ){ tablewidget::updateRowInTable( table,entry.entryList(),row,this->getSystemVolumeFont() ) ; }else{ tablewidget::updateRowInTable( table,entry.entryList(),row,this->font() ) ; } tablewidget::selectRow( table,row ) ; } }
void MainWindow::showMoungDialog( const volumeEntryProperties& v ) { if( v.isEmpty() ){ DialogMsg msg( this ) ; msg.ShowUIOK( tr( "ERROR" ), tr( "Permission to access the volume was denied\nor\nthe volume is not supported\n(LVM/MDRAID signatures found)" ) ) ; this->enableAll() ; }else{ this->mount( v ) ; } }
void MainWindow::mount( const volumeEntryProperties& entry ) { this->disableAll() ; if( entry.encryptedVolume() ){ auto kd = new keyDialog( this,m_ui->tableWidget,entry ) ; connect( kd,SIGNAL( cancel() ),this,SLOT( enableAll() ) ) ; connect( kd,SIGNAL( openMountPoint( QString ) ),this,SLOT( openMountPointPath( QString ) ) ) ; kd->ShowUI() ; }else{ auto mp = new mountPartition( this,m_ui->tableWidget ) ; connect( mp,SIGNAL( cancel() ),this,SLOT( enableAll() ) ) ; connect( mp,SIGNAL( openMountPoint( QString ) ),this,SLOT( openMountPointPath( QString ) ) ) ; mp->ShowUI( entry ) ; } }
keyDialog::keyDialog( QWidget * parent,QTableWidget * table,const volumeEntryProperties& e,std::function< void() > p,std::function< void( const QString& ) > q ) : QDialog( parent ),m_ui( new Ui::keyDialog ),m_cancel( std::move( p ) ),m_success( std::move( q ) ) { m_ui->setupUi( this ) ; m_ui->checkBoxShareMountPoint->setToolTip( utility::shareMountPointToolTip() ) ; m_table = table ; m_path = e.volumeName() ; m_working = false ; m_volumeIsEncFs = e.fileSystem() == "encfs" ; QString msg ; if( e.fileSystem() == "crypto_LUKS" ){ msg = tr( "Mount A LUKS volume in \"%1\"").arg( m_path ) ; }else{ msg = tr( "Mount An Encrypted Volume In \"%1\"").arg( m_path ) ; } this->setWindowTitle( msg ) ; m_ui->lineEditMountPoint->setText( m_path ) ; m_ui->pbOpenMountPoint->setIcon( QIcon( ":/folder.png" ) ) ; m_menu = new QMenu( this ) ; connect( m_menu,SIGNAL( triggered( QAction * ) ),this,SLOT( pbPluginEntryClicked( QAction * ) ) ) ; this->setFixedSize( this->size() ) ; this->setWindowFlags( Qt::Window | Qt::Dialog ) ; this->setFont( parent->font() ) ; m_ui->lineEditKey->setFocus() ; m_ui->checkBoxOpenReadOnly->setChecked( utility::getOpenVolumeReadOnlyOption( "zuluMount-gui" ) ) ; m_ui->pbkeyOption->setEnabled( false ) ; m_ui->lineEditKey->setEchoMode( QLineEdit::Password ) ; connect( m_ui->pbOptions,SIGNAL( clicked() ),this,SLOT( pbOptions() ) ) ; connect( m_ui->pbCancel,SIGNAL( clicked() ),this,SLOT( pbCancel() ) ) ; connect( m_ui->pbOpen,SIGNAL( clicked() ),this,SLOT( pbOpen() ) ) ; connect( m_ui->pbkeyOption,SIGNAL( clicked() ),this,SLOT( pbkeyOption() ) ) ; connect( m_ui->pbOpenMountPoint,SIGNAL( clicked() ),this,SLOT( pbMountPointPath() ) ) ; connect( m_ui->checkBoxOpenReadOnly,SIGNAL( stateChanged( int ) ),this,SLOT( cbMountReadOnlyStateChanged( int ) ) ) ; connect( m_ui->cbKeyType,SIGNAL( currentIndexChanged( int ) ),this,SLOT( cbActicated( int ) ) ) ; m_ui->pbOpenMountPoint->setVisible( false ) ; m_point = utility::mountPathPostFix( m_path.split( "/" ).last() ) ; m_ui->lineEditMountPoint->setText( m_point ) ; QAction * ac = new QAction( this ) ; QKeySequence s( Qt::CTRL + Qt::Key_F ) ; ac->setShortcut( s ) ; connect( ac,SIGNAL( triggered() ),this,SLOT( showOffSetWindowOption() ) ) ; this->addAction( ac ) ; m_menu_1 = new QMenu( this ) ; auto _add_action = [ & ]( const QString& e ){ ac = m_menu_1->addAction( e ) ; ac ->setEnabled( !m_volumeIsEncFs ) ; } ; _add_action( tr( "Set File System Options" ) ) ; _add_action( tr( "Set Volume Offset" ) ) ; _add_action( tr( "Set Volume As VeraCrypt Volume" ) ) ; _add_action( tr( "Set VeraCrypt PIM value" ) ) ; m_ui->cbKeyType->addItem( tr( "Key" ) ) ; m_ui->cbKeyType->addItem( tr( "KeyFile" ) ) ; m_ui->cbKeyType->addItem( tr( "Plugin" ) ) ; if( m_volumeIsEncFs ){ m_ui->checkBoxShareMountPoint->setEnabled( false ) ; }else{ #if VERACRYPT_SUPPORT m_ui->cbKeyType->addItem( tr( "TrueCrypt/VeraCrypt Keys" ) ) ; #else m_ui->cbKeyType->addItem( tr( "TrueCrypt keys" ) ) ; #endif } connect( m_menu_1,SIGNAL( triggered( QAction * ) ),this,SLOT( doAction( QAction * ) ) ) ; m_veraCryptWarning.setWarningLabel( m_ui->veraCryptWarning ) ; this->installEventFilter( this ) ; }