mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Coding style fixes.
This commit is contained in:
parent
2ac659f408
commit
e4bc302d3d
@ -115,7 +115,8 @@ void DatabaseOpenDialog::openDatabase()
|
||||
accept();
|
||||
}
|
||||
else {
|
||||
QMessageBox::warning(this, tr("Error"), tr("Unable to open the database.\n%1").arg(reader.errorString()));
|
||||
QMessageBox::warning(this, tr("Error"), tr("Unable to open the database.\n%1")
|
||||
.arg(reader.errorString()));
|
||||
m_ui->editPassword->clear();
|
||||
}
|
||||
}
|
||||
@ -137,7 +138,8 @@ void DatabaseOpenDialog::activateKeyFile()
|
||||
|
||||
void DatabaseOpenDialog::setOkButtonEnabled()
|
||||
{
|
||||
bool enable = m_ui->checkPassword->isChecked() || (m_ui->checkKeyFile->isChecked() && !m_ui->comboKeyFile->currentText().isEmpty());
|
||||
bool enable = m_ui->checkPassword->isChecked()
|
||||
|| (m_ui->checkKeyFile->isChecked() && !m_ui->comboKeyFile->currentText().isEmpty());
|
||||
|
||||
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(enable);
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ bool DatabaseTabWidget::closeDatabase(Database* db)
|
||||
if (dbName.right(1) == "*") {
|
||||
dbName.chop(1);
|
||||
}
|
||||
if (dbStruct.dbWidget->currentMode() == DatabaseWidget::EditMode){
|
||||
if (dbStruct.dbWidget->currentMode() == DatabaseWidget::EditMode) {
|
||||
QMessageBox::StandardButton result =
|
||||
QMessageBox::question(
|
||||
this, tr("Close?"),
|
||||
@ -403,11 +403,14 @@ void DatabaseTabWidget::insertDatabase(Database* db, const DatabaseManagerStruct
|
||||
int index = databaseIndex(db);
|
||||
setCurrentIndex(index);
|
||||
|
||||
connect(db->metadata(), SIGNAL(nameTextChanged(Database*)), SLOT(updateTabName(Database*)));
|
||||
connect(dbStruct.dbWidget->entryView(), SIGNAL(entrySelectionChanged()), SLOT(emitEntrySelectionChanged()));
|
||||
connect(db->metadata(), SIGNAL(nameTextChanged(Database*)),
|
||||
SLOT(updateTabName(Database*)));
|
||||
connect(dbStruct.dbWidget->entryView(), SIGNAL(entrySelectionChanged()),
|
||||
SLOT(emitEntrySelectionChanged()));
|
||||
connect(dbStruct.dbWidget, SIGNAL(closeRequest()), SLOT(closeDatabase()));
|
||||
connect(db, SIGNAL(modified()), SLOT(modified()));
|
||||
connect(dbStruct.dbWidget, SIGNAL(currentModeChanged(DatabaseWidget::Mode)), this, SIGNAL(currentWidgetModeChanged(DatabaseWidget::Mode)));
|
||||
connect(dbStruct.dbWidget, SIGNAL(currentModeChanged(DatabaseWidget::Mode)),
|
||||
SIGNAL(currentWidgetModeChanged(DatabaseWidget::Mode)));
|
||||
}
|
||||
|
||||
DatabaseWidget* DatabaseTabWidget::currentDatabaseWidget()
|
||||
|
@ -94,21 +94,19 @@ DatabaseWidget::DatabaseWidget(Database* db, QWidget* parent)
|
||||
DatabaseWidget::Mode DatabaseWidget::currentMode()
|
||||
{
|
||||
switch (currentIndex()) {
|
||||
case -1:
|
||||
return DatabaseWidget::None;
|
||||
break;
|
||||
case 0:
|
||||
return DatabaseWidget::ViewMode;
|
||||
break;
|
||||
case 1: // entry edit
|
||||
case 2: // group edit
|
||||
case 3: // change master key
|
||||
case 4: // database settings
|
||||
return DatabaseWidget::EditMode;
|
||||
break;
|
||||
case -1:
|
||||
return DatabaseWidget::None;
|
||||
case 0:
|
||||
return DatabaseWidget::ViewMode;
|
||||
case 1: // entry edit
|
||||
case 2: // group edit
|
||||
case 3: // change master key
|
||||
case 4: // database settings
|
||||
return DatabaseWidget::EditMode;
|
||||
default:
|
||||
Q_ASSERT(false);
|
||||
return DatabaseWidget::None;
|
||||
}
|
||||
|
||||
return DatabaseWidget::None;
|
||||
}
|
||||
|
||||
void DatabaseWidget::emitCurrentModeChanged()
|
||||
|
@ -37,9 +37,9 @@ class DatabaseWidget : public QStackedWidget
|
||||
public:
|
||||
enum Mode
|
||||
{
|
||||
None = 0,
|
||||
ViewMode = 1,
|
||||
EditMode = 2
|
||||
None,
|
||||
ViewMode,
|
||||
EditMode
|
||||
};
|
||||
|
||||
explicit DatabaseWidget(Database* db, QWidget* parent = 0);
|
||||
@ -55,7 +55,7 @@ public:
|
||||
|
||||
Q_SIGNALS:
|
||||
void closeRequest();
|
||||
void currentModeChanged(DatabaseWidget::Mode);
|
||||
void currentModeChanged(DatabaseWidget::Mode mode);
|
||||
|
||||
public Q_SLOTS:
|
||||
void createEntry();
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include <QtGui/QDialogButtonBox>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QKeyEvent>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
DialogyWidget::DialogyWidget(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
@ -30,7 +29,7 @@ DialogyWidget::DialogyWidget(QWidget* parent)
|
||||
void DialogyWidget::keyPressEvent(QKeyEvent *e)
|
||||
{
|
||||
#ifdef Q_WS_MAC
|
||||
if(e->modifiers() == Qt::ControlModifier && e->key() == Qt::Key_Period) {
|
||||
if (e->modifiers() == Qt::ControlModifier && e->key() == Qt::Key_Period) {
|
||||
if (!clickButton(QDialogButtonBox::Cancel)) {
|
||||
e->ignore();
|
||||
}
|
||||
|
@ -33,7 +33,6 @@ protected:
|
||||
|
||||
private:
|
||||
bool clickButton(QDialogButtonBox::StandardButton standardButton);
|
||||
|
||||
};
|
||||
|
||||
#endif // KEEPASSX_DIALOGYWIDGET_H
|
||||
|
@ -33,24 +33,41 @@ MainWindow::MainWindow()
|
||||
|
||||
setWindowIcon(dataPath()->applicationIcon());
|
||||
|
||||
connect(m_ui->tabWidget, SIGNAL(entrySelectionChanged(bool)), SLOT(setMenuActionState()));
|
||||
connect(m_ui->tabWidget, SIGNAL(currentWidgetModeChanged(DatabaseWidget::Mode)), SLOT(setMenuActionState(DatabaseWidget::Mode)));
|
||||
connect(m_ui->tabWidget, SIGNAL(tabNameChanged()), SLOT(updateWindowTitle()));
|
||||
connect(m_ui->tabWidget, SIGNAL(currentChanged(int)), SLOT(updateWindowTitle()));
|
||||
connect(m_ui->tabWidget, SIGNAL(entrySelectionChanged(bool)),
|
||||
SLOT(setMenuActionState()));
|
||||
connect(m_ui->tabWidget, SIGNAL(currentWidgetModeChanged(DatabaseWidget::Mode)),
|
||||
SLOT(setMenuActionState(DatabaseWidget::Mode)));
|
||||
connect(m_ui->tabWidget, SIGNAL(tabNameChanged()),
|
||||
SLOT(updateWindowTitle()));
|
||||
connect(m_ui->tabWidget, SIGNAL(currentChanged(int)),
|
||||
SLOT(updateWindowTitle()));
|
||||
|
||||
connect(m_ui->actionDatabaseNew, SIGNAL(triggered()), m_ui->tabWidget, SLOT(newDatabase()));
|
||||
connect(m_ui->actionDatabaseOpen, SIGNAL(triggered()), m_ui->tabWidget, SLOT(openDatabase()));
|
||||
connect(m_ui->actionDatabaseSave, SIGNAL(triggered()), m_ui->tabWidget, SLOT(saveDatabase()));
|
||||
connect(m_ui->actionDatabaseSaveAs, SIGNAL(triggered()), m_ui->tabWidget, SLOT(saveDatabaseAs()));
|
||||
connect(m_ui->actionDatabaseClose, SIGNAL(triggered()), m_ui->tabWidget, SLOT(closeDatabase()));
|
||||
connect(m_ui->actionChangeMasterKey, SIGNAL(triggered()), m_ui->tabWidget, SLOT(changeMasterKey()));
|
||||
connect(m_ui->actionChangeDatabaseSettings, SIGNAL(triggered()), m_ui->tabWidget, SLOT(changeDatabaseSettings()));
|
||||
connect(m_ui->actionEntryNew, SIGNAL(triggered()), m_ui->tabWidget, SLOT(createEntry()));
|
||||
connect(m_ui->actionEntryEdit, SIGNAL(triggered()), m_ui->tabWidget, SLOT(editEntry()));
|
||||
connect(m_ui->actionEntryDelete, SIGNAL(triggered()), m_ui->tabWidget, SLOT(deleteEntry()));
|
||||
connect(m_ui->actionGroupNew, SIGNAL(triggered()), m_ui->tabWidget, SLOT(createGroup()));
|
||||
connect(m_ui->actionGroupEdit, SIGNAL(triggered()), m_ui->tabWidget, SLOT(editGroup()));
|
||||
connect(m_ui->actionGroupDelete, SIGNAL(triggered()), m_ui->tabWidget, SLOT(deleteGroup()));
|
||||
connect(m_ui->actionDatabaseNew, SIGNAL(triggered()), m_ui->tabWidget,
|
||||
SLOT(newDatabase()));
|
||||
connect(m_ui->actionDatabaseOpen, SIGNAL(triggered()), m_ui->tabWidget,
|
||||
SLOT(openDatabase()));
|
||||
connect(m_ui->actionDatabaseSave, SIGNAL(triggered()), m_ui->tabWidget,
|
||||
SLOT(saveDatabase()));
|
||||
connect(m_ui->actionDatabaseSaveAs, SIGNAL(triggered()), m_ui->tabWidget,
|
||||
SLOT(saveDatabaseAs()));
|
||||
connect(m_ui->actionDatabaseClose, SIGNAL(triggered()), m_ui->tabWidget,
|
||||
SLOT(closeDatabase()));
|
||||
connect(m_ui->actionChangeMasterKey, SIGNAL(triggered()), m_ui->tabWidget,
|
||||
SLOT(changeMasterKey()));
|
||||
connect(m_ui->actionChangeDatabaseSettings, SIGNAL(triggered()), m_ui->tabWidget,
|
||||
SLOT(changeDatabaseSettings()));
|
||||
connect(m_ui->actionEntryNew, SIGNAL(triggered()), m_ui->tabWidget,
|
||||
SLOT(createEntry()));
|
||||
connect(m_ui->actionEntryEdit, SIGNAL(triggered()), m_ui->tabWidget,
|
||||
SLOT(editEntry()));
|
||||
connect(m_ui->actionEntryDelete, SIGNAL(triggered()), m_ui->tabWidget,
|
||||
SLOT(deleteEntry()));
|
||||
connect(m_ui->actionGroupNew, SIGNAL(triggered()), m_ui->tabWidget,
|
||||
SLOT(createGroup()));
|
||||
connect(m_ui->actionGroupEdit, SIGNAL(triggered()), m_ui->tabWidget,
|
||||
SLOT(editGroup()));
|
||||
connect(m_ui->actionGroupDelete, SIGNAL(triggered()), m_ui->tabWidget,
|
||||
SLOT(deleteGroup()));
|
||||
connect(m_ui->actionQuit, SIGNAL(triggered()), SLOT(close()));
|
||||
}
|
||||
|
||||
@ -77,44 +94,44 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
|
||||
}
|
||||
|
||||
switch (mode) {
|
||||
case DatabaseWidget::ViewMode:
|
||||
m_ui->actionEntryNew->setEnabled(true);
|
||||
m_ui->actionGroupNew->setEnabled(true);
|
||||
if (dbWidget->entryView()->currentIndex().isValid()) {
|
||||
m_ui->actionEntryEdit->setEnabled(true);
|
||||
m_ui->actionEntryDelete->setEnabled(true);
|
||||
}
|
||||
else {
|
||||
m_ui->actionEntryEdit->setEnabled(false);
|
||||
m_ui->actionEntryDelete->setEnabled(false);
|
||||
}
|
||||
m_ui->actionGroupEdit->setEnabled(true);
|
||||
|
||||
if (dbWidget->canDeleteCurrentGoup()) {
|
||||
m_ui->actionGroupDelete->setEnabled(true);
|
||||
}
|
||||
else {
|
||||
m_ui->actionGroupDelete->setEnabled(false);
|
||||
}
|
||||
m_ui->actionChangeMasterKey->setEnabled(true);
|
||||
m_ui->actionChangeDatabaseSettings->setEnabled(true);
|
||||
m_ui->actionDatabaseSave->setEnabled(true);
|
||||
m_ui->actionDatabaseSaveAs->setEnabled(true);
|
||||
break;
|
||||
case DatabaseWidget::EditMode:
|
||||
m_ui->actionEntryNew->setEnabled(false);
|
||||
m_ui->actionGroupNew->setEnabled(false);
|
||||
case DatabaseWidget::ViewMode:
|
||||
m_ui->actionEntryNew->setEnabled(true);
|
||||
m_ui->actionGroupNew->setEnabled(true);
|
||||
if (dbWidget->entryView()->currentIndex().isValid()) {
|
||||
m_ui->actionEntryEdit->setEnabled(true);
|
||||
m_ui->actionEntryDelete->setEnabled(true);
|
||||
}
|
||||
else {
|
||||
m_ui->actionEntryEdit->setEnabled(false);
|
||||
m_ui->actionGroupEdit->setEnabled(false);
|
||||
m_ui->actionEntryDelete->setEnabled(false);
|
||||
}
|
||||
m_ui->actionGroupEdit->setEnabled(true);
|
||||
|
||||
if (dbWidget->canDeleteCurrentGoup()) {
|
||||
m_ui->actionGroupDelete->setEnabled(true);
|
||||
}
|
||||
else {
|
||||
m_ui->actionGroupDelete->setEnabled(false);
|
||||
m_ui->actionChangeMasterKey->setEnabled(false);
|
||||
m_ui->actionChangeDatabaseSettings->setEnabled(false);
|
||||
m_ui->actionDatabaseSave->setEnabled(false);
|
||||
m_ui->actionDatabaseSaveAs->setEnabled(false);
|
||||
break;
|
||||
default:
|
||||
Q_ASSERT(false);
|
||||
}
|
||||
m_ui->actionChangeMasterKey->setEnabled(true);
|
||||
m_ui->actionChangeDatabaseSettings->setEnabled(true);
|
||||
m_ui->actionDatabaseSave->setEnabled(true);
|
||||
m_ui->actionDatabaseSaveAs->setEnabled(true);
|
||||
break;
|
||||
case DatabaseWidget::EditMode:
|
||||
m_ui->actionEntryNew->setEnabled(false);
|
||||
m_ui->actionGroupNew->setEnabled(false);
|
||||
m_ui->actionEntryEdit->setEnabled(false);
|
||||
m_ui->actionGroupEdit->setEnabled(false);
|
||||
m_ui->actionEntryDelete->setEnabled(false);
|
||||
m_ui->actionGroupDelete->setEnabled(false);
|
||||
m_ui->actionChangeMasterKey->setEnabled(false);
|
||||
m_ui->actionChangeDatabaseSettings->setEnabled(false);
|
||||
m_ui->actionDatabaseSave->setEnabled(false);
|
||||
m_ui->actionDatabaseSaveAs->setEnabled(false);
|
||||
break;
|
||||
default:
|
||||
Q_ASSERT(false);
|
||||
}
|
||||
m_ui->actionDatabaseClose->setEnabled(true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user