remember last selected tab, hide passwords by default

This commit is contained in:
thez3ro 2017-09-29 22:02:07 +02:00
parent 9279bf7628
commit 71ae2a3458
No known key found for this signature in database
GPG Key ID: F628F9E41DD7C073
3 changed files with 21 additions and 3 deletions

View File

@ -131,6 +131,7 @@ void Config::init(const QString& fileName)
m_defaults.insert("security/lockdatabasescreenlock", true);
m_defaults.insert("security/passwordsrepeat", false);
m_defaults.insert("security/passwordscleartext", false);
m_defaults.insert("security/hidepassworddetails", true);
m_defaults.insert("security/autotypeask", true);
m_defaults.insert("security/IconDownloadFallbackToGoogle", false);
m_defaults.insert("GUI/Language", "system");

View File

@ -35,6 +35,8 @@ DetailsWidget::DetailsWidget(QWidget* parent)
, m_currentGroup(nullptr)
, m_attributesWidget(nullptr)
, m_autotypeWidget(nullptr)
, m_selectedTabEntry(0)
, m_selectedTabGroup(0)
{
m_ui->setupUi(this);
@ -47,6 +49,7 @@ DetailsWidget::DetailsWidget(QWidget* parent)
connect(m_ui->totpButton, SIGNAL(toggled(bool)), SLOT(showTotp(bool)));
connect(m_ui->closeButton, SIGNAL(toggled(bool)), SLOT(hideDetails()));
connect(m_ui->tabWidget, SIGNAL(tabBarClicked(int)), SLOT(updateTabIndex(int)));
this->hide();
}
@ -170,6 +173,10 @@ void DetailsWidget::getSelectedEntry(Entry* selectedEntry)
m_ui->autotypeTree->addTopLevelItems(items);
m_ui->tabWidget->setTabEnabled(AutotypeTab, true);
}
if (m_ui->tabWidget->isTabEnabled(m_selectedTabEntry)) {
m_ui->tabWidget->setCurrentIndex(m_selectedTabEntry);
}
}
void DetailsWidget::getSelectedGroup(Group* selectedGroup)
@ -234,6 +241,10 @@ void DetailsWidget::getSelectedGroup(Group* selectedGroup)
} else {
m_ui->groupExpirationLabel->setText(tr("Never"));
}
if (m_ui->tabWidget->isTabEnabled(m_selectedTabGroup)) {
m_ui->tabWidget->setCurrentIndex(m_selectedTabGroup);
}
}
void DetailsWidget::updateTotp()
@ -301,6 +312,10 @@ void DetailsWidget::setDatabaseMode(DatabaseWidget::Mode mode)
}
}
void DetailsWidget::copyToClipboard(const QString& text) {
clipboard()->setText(text);
void DetailsWidget::updateTabIndex(int index) {
if (m_ui->stackedWidget->currentIndex() == GroupPreview) {
m_selectedTabGroup = index;
} else {
m_selectedTabEntry = index;
}
}

View File

@ -56,7 +56,7 @@ private slots:
void updateTotp();
void hideDetails();
void setDatabaseMode(DatabaseWidget::Mode mode);
void copyToClipboard(const QString& text);
void updateTabIndex(int index);
private:
const QScopedPointer<Ui::DetailsWidget> m_ui;
@ -67,6 +67,8 @@ private:
QTimer* m_timer;
QWidget* m_attributesWidget;
QWidget* m_autotypeWidget;
quint8 m_selectedTabEntry;
quint8 m_selectedTabGroup;
QString shortUrl(QString url);
QString shortPassword(QString password);
};