mirror of
https://github.com/chris2511/xca.git
synced 2026-09-12 19:51:05 +05:00
Allow to remove the default database setting
... by setting "As default database" if no database is open
This commit is contained in:
parent
82123245c4
commit
6f20a17ff9
@ -266,12 +266,17 @@ void MainWindow::default_database()
|
||||
{
|
||||
QFileInfo fi(dbfile);
|
||||
QString dir = getUserSettingsDir();
|
||||
QString file = dir +QDir::separator() +"defaultdb";
|
||||
FILE *fp;
|
||||
|
||||
QDir d;
|
||||
|
||||
if (dbfile.isEmpty()) {
|
||||
QFile::remove(file);
|
||||
return;
|
||||
}
|
||||
d.mkpath(dir);
|
||||
|
||||
fp = fopen(QString2filename(dir +QDir::separator() +"defaultdb"), "w");
|
||||
fp = fopen(QString2filename(file), "w");
|
||||
if (fp) {
|
||||
QByteArray ba;
|
||||
ba = filename2bytearray(fi.canonicalFilePath() + "\n");
|
||||
@ -281,11 +286,6 @@ void MainWindow::default_database()
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::no_default_database()
|
||||
{
|
||||
QFile::remove(getUserSettingsDir() + QDir::separator() + "defaultdb");
|
||||
}
|
||||
|
||||
void MainWindow::close_database()
|
||||
{
|
||||
QByteArray ba;
|
||||
@ -346,6 +346,7 @@ void MainWindow::close_database()
|
||||
update_history(dbfile);
|
||||
pkcs11::remove_libs();
|
||||
enableTokenMenu(pkcs11::loaded());
|
||||
dbfile.clear();
|
||||
}
|
||||
|
||||
void MainWindow::load_history()
|
||||
|
||||
@ -91,10 +91,8 @@ void MainWindow::init_menu()
|
||||
file->addMenu(historyMenu);
|
||||
file->addAction(tr("Generate DH parameter"), this,
|
||||
SLOT(generateDHparam()));
|
||||
acList += file->addAction(tr("Set as default DataBase"), this,
|
||||
file->addAction(tr("Set as default DataBase"), this,
|
||||
SLOT(default_database()));
|
||||
acList += file->addAction(tr("No default DataBase"), this,
|
||||
SLOT(no_default_database()));
|
||||
acList += file->addAction(tr("&Close DataBase"), this,
|
||||
SLOT(close_database()), QKeySequence(QKeySequence::Close));
|
||||
acList += file->addAction(tr("&Dump DataBase"), this,
|
||||
|
||||
@ -144,7 +144,6 @@ class MainWindow: public QMainWindow, public Ui::MainWindow
|
||||
void close_database();
|
||||
void dump_database();
|
||||
void default_database();
|
||||
void no_default_database();
|
||||
void connNewX509(NewX509 *nx);
|
||||
void about();
|
||||
void donations();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user