Continue working on requesting the user for a filename for a password

This commit is contained in:
amazing-username
2018-03-08 15:46:21 -06:00
parent 05b559bacf
commit d1662f12fb
4 changed files with 51 additions and 2 deletions
+45
View File
@@ -15,6 +15,7 @@ MainWindow::MainWindow()
QWidget* w = 0;
ph = unique_ptr<PasswordManagementWindow>{new PasswordManagementWindow};
kh = unique_ptr<KeyManagementWindow>{new KeyManagementWindow{w, mw, ph.get()}};
sf = unique_ptr<SaveFile>{new SaveFile};
setupMainWindow();
}
@@ -91,17 +92,60 @@ void MainWindow::connections()
QObject::connect(actionButton.get(), SIGNAL(clicked()), this, SLOT(encryptPassword()));
QObject::connect(textForCryption.get(), SIGNAL(textChanged()), this, SLOT(activateButton()));
}
void MainWindow::switchControlEnabling()
{
if (controlsEnabled)
{
switchControls(!controlsEnabled);
controlsEnabled = false;
}
else
{
switchControls(!controlsEnabled);
controlsEnabled = true;
}
}
void MainWindow::switchControls(const bool enabled)
{
textForCryption.get()->setEnabled(enabled);
selectionBox.get()->setEnabled(enabled);
actionButton.get()->setEnabled(enabled);
passwordManage.get()->setEnabled(enabled);
}
void MainWindow::requestFilename()
{
std::cout<<"Start"<<std::endl;
//sf.get()->show();
SaveFile* sfo = new SaveFile{};
sfo->show();
//sfo->quit();
std::cout<<"End"<<std::endl;
}
/*
* February 26, 2018
*
* Work on asking the user to enter a filename
*
* Update: February 27, 2018
*
* Continue working on asking the user for a filename.
* I got it working so the controls that are related to
* passwords are disabled. What needs to be done is
* have it so that the password is not encrypted until
* the button for confirming the password filename is
* clicked. Might have to create a helper function
* for the encryptPassword function
*/
void MainWindow::encryptPassword()
{
requestFilename();
switchControlEnabling();
/**
QString passwordToEncrypt{textForCryption.get()->toPlainText()}, keyForEncryption{selectionBox.get()->currentText()};
auto passwordToEncryptString = passwordToEncrypt.toStdString(), keyForEncryptionString = FolderStructure::keyDirectory+keyForEncryption.toStdString();
std::cout<<"Generated filename that contains encrypted password: "<<passwordToEncryptString<<std::endl;
auto strKeyFilename = keyForEncryption.toStdString();
Password<> pass{};
Key<> k;
@@ -111,6 +155,7 @@ void MainWindow::encryptPassword()
Encryption ec2{pass, k};
std::cout<<"Encrypted"<<std::endl;
ph.get()->populatePass();
*/
}
void MainWindow::keyManagementWindow() { kh.get()->show(); }
void MainWindow::passwordManageWindow() { ph.get()->show(); }
+5
View File
@@ -37,6 +37,9 @@ private:
void setupContentOfComboBox();
void createMenus();
void connections();
void switchControlEnabling();
void switchControls(const bool);
void requestFilename();
unique_ptr<QVBoxLayout> buttonLayout;
@@ -55,7 +58,9 @@ private:
unique_ptr<KeyManagementWindow> kh;
unique_ptr<PasswordManagementWindow> ph;
unique_ptr<SaveFile> sf;
string grabCryptionText();
bool controlsEnabled{true};
};
#endif
-1
View File
@@ -83,5 +83,4 @@ bool Password<S>::repetitive()
}
return false;
}
#endif
+1 -1
View File
@@ -34,5 +34,5 @@ void SaveFile::connections()
}
void SaveFile::saveFileAs()
{
this->hide();
}