Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Call 'pass git init' on creation of password-store when useGit #78

Merged
merged 1 commit into from
Aug 3, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ void Dialog::wizard()
}

QStringList names = mainWindow->getSecretKeys();
//qDebug() << names;
qDebug() << names;
if (QFile(gpg).exists() && names.empty()) {
KeygenDialog d(this);
if (!d.exec()) {
Expand All @@ -511,11 +511,17 @@ void Dialog::wizard()
tr("Would you like to create a password-store at %1?").arg(passStore),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
QDir().mkdir(passStore);

if(useGit()) {
mainWindow->executePassGitInit();
}
mainWindow->userDialog(passStore);
}
}

if(!QFile(passStore + ".gpg-id").exists()){
qDebug() << ".gpg-id file does not exist";

if (!clean) {
criticalMessage(tr("Password store not initialised"),
tr("The folder %1 doesn't seem to be a password store or is not yet initialised.").arg(passStore));
Expand All @@ -528,6 +534,7 @@ void Dialog::wizard()
passStore = ui->storePath->text();
}
if (!QFile(passStore + ".gpg-id").exists()) {
qDebug() << ".gpg-id file still does not exist :/";
// appears not to be store
// init yes / no ?
mainWindow->userDialog(passStore);
Expand Down
11 changes: 10 additions & 1 deletion mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,12 @@ MainWindow::~MainWindow()
QSettings &MainWindow::getSettings() {
if (!settings) {
QString portable_ini = QCoreApplication::applicationDirPath() + QDir::separator() + "qtpass.ini";
qDebug() << "Settings file: " + portable_ini;
if (QFile(portable_ini).exists()) {
qDebug() << "Settings file exists, loading it in";
settings.reset(new QSettings(portable_ini, QSettings::IniFormat));
} else {
qDebug() << "Settings file does not exist, use defaults";
settings.reset(new QSettings("IJHack", "QtPass"));
}
}
Expand Down Expand Up @@ -543,6 +546,11 @@ void MainWindow::executePass(QString args, QString input) {
executeWrapper(passExecutable, args, input);
}

void MainWindow::executePassGitInit() {
qDebug() << "Pass git init called";
executePass("git init");
}

/**
* @brief MainWindow::executeWrapper
* @param app
Expand All @@ -564,8 +572,9 @@ void MainWindow::executeWrapper(QString app, QString args, QString input) {
item.app = app;
item.args = args;
item.input = input;

execQueue->enqueue(item);
//qDebug() << item.app + "," + item.args + "," + item.input;
qDebug() << item.app + "," + item.args + "," + item.input;
return;
}
wrapperRunning = true;
Expand Down
1 change: 1 addition & 0 deletions mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ enum actionType { GPG, GIT, EDIT, DELETE, GPG_INTERNAL, PWGEN };
void generateKeyPair(QString, QDialog *);
void userDialog(QString = "");
QString generatePassword();
void executePassGitInit();

protected:
void closeEvent(QCloseEvent *event);
Expand Down