X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fmainwindow.cpp;h=8566b7359329c97b9a8881d1da719bd5b31c2d9b;hb=b420767be6c6ba849f7f7d5c8e4df77aa64ce65a;hp=9d8a7c923b633557dff6ed1cc668d9fd55152971;hpb=67c7c2827ffb28524eec4e20911ce1e820aa46b5;p=secretnotes diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 9d8a7c9..8566b73 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -47,6 +47,10 @@ MainWindow::MainWindow(QWidget *parent) : connect(undoEditAction,SIGNAL(triggered()), this, SLOT(undoEdit())); on_textEdit_undoAvailable(false); + changePasswordAction = ui->menuOptions->addAction(tr("Change password")); + connect(changePasswordAction, SIGNAL(triggered()), this, SLOT(on_actionChange_password_triggered())); + enableChangePasswordAction(false); + /* the secret notes file is stored in user home directory */ filePath = QDir::fromNativeSeparators(QDir::homePath()); @@ -172,6 +176,7 @@ void MainWindow::readFile() plaintext = decoded; ui->textEdit->setPlainText(plaintext); enableTextEdit(true); + enableChangePasswordAction(true); } decoded.fill(0); } @@ -321,6 +326,7 @@ void MainWindow::askNewPassword() QString pass = dialog.getPassword(); setPassword(pass); pass.fill(0); + enableChangePasswordAction(true); return; } } @@ -350,3 +356,8 @@ void MainWindow::enableResetAction(bool b) { resetAction->setVisible(b); } + +void MainWindow::enableChangePasswordAction(bool b) +{ + changePasswordAction->setVisible(b); +}