GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — sqlitebrowser/src/CipherDialog.cpp at master · optionalg/sqlitebrowser

Expand file tree

/

CipherDialog.cpp

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
77 lines (66 loc) · 2.67 KB
/

CipherDialog.cpp

Copy path

File metadata and controls

77 lines (66 loc) · 2.67 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include "CipherDialog.h"
#include "ui_CipherDialog.h"
#include <QPushButton>
#include <QRegExpValidator>
CipherDialog::CipherDialog(QWidget* parent, bool encrypt) :
QDialog(parent),
ui(new Ui::CipherDialog),
encryptMode(encrypt),
rawKeyValidator(new QRegExpValidator(QRegExp("0x[a-fA-F0-9]+")))
{
ui->setupUi(this);
if(encrypt)
{
ui->labelDialogDescription->setText(tr("Please set a key to encrypt the database.\nNote that if you change any of the other, optional, settings you'll need "
"to re-enter them as well every time you open the database file.\nLeave the password fields empty to disable the "
"encryption.\nThe encryption process might take some time and you should have a backup copy of your database! Unsaved "
"changes are applied before modifying the encryption."));
} else {
ui->labelDialogDescription->setText(tr("Please enter the key used to encrypt the database.\nIf any of the other settings were altered for this database file "
"you need to provide this information as well."));
ui->editPassword2->setVisible(false);
ui->labelPassword2->setVisible(false);
}
}
CipherDialog::~CipherDialog()
{
delete rawKeyValidator;
delete ui;
}
CipherDialog::KeyFormats CipherDialog::keyFormat() const
{
return static_cast<CipherDialog::KeyFormats>(ui->comboKeyFormat->currentIndex());
}
QString CipherDialog::password() const
{
if(keyFormat() == KeyFormats::Passphrase)
return QString("'%1'").arg(ui->editPassword->text());
else
return QString("\"x'%1'\"").arg(ui->editPassword->text().mid(2)); // Remove the '0x' part at the beginning
}
int CipherDialog::pageSize() const
{
return ui->spinPageSize->value();
}
void CipherDialog::checkInputFields()
{
if(sender() == ui->comboKeyFormat)
{
if(keyFormat() == KeyFormats::Passphrase)
{
ui->editPassword->setValidator(0);
ui->editPassword2->setValidator(0);
ui->editPassword->setPlaceholderText("");
} else if(keyFormat() == KeyFormats::RawKey) {
ui->editPassword->setValidator(rawKeyValidator);
ui->editPassword2->setValidator(rawKeyValidator);
ui->editPassword->setPlaceholderText("0x...");
}
ui->editPassword->setText("");
ui->editPassword2->setText("");
}
bool valid = true;
if(encryptMode)
valid = ui->editPassword->text() == ui->editPassword2->text();
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(valid);
}
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.