mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01:00
[PasswordManager] Give user feedback when importing/exporting passwords.
This commit is contained in:
parent
7e2b631f34
commit
30594f2480
|
@ -276,12 +276,30 @@ void AutoFillManager::showExceptions()
|
|||
|
||||
void AutoFillManager::importPasswords()
|
||||
{
|
||||
const QString &fileName = QFileDialog::getOpenFileName(this, tr("Choose file..."), QDir::homePath() + "/passwords.xml", "*.xml");
|
||||
if (fileName.isEmpty()) {
|
||||
m_fileName = QFileDialog::getOpenFileName(this, tr("Choose file..."), QDir::homePath() + "/passwords.xml", "*.xml");
|
||||
|
||||
if (m_fileName.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QFile file(fileName);
|
||||
QTimer::singleShot(0, this, SLOT(slotImportPasswords()));
|
||||
}
|
||||
|
||||
void AutoFillManager::exportPasswords()
|
||||
{
|
||||
m_fileName = QFileDialog::getSaveFileName(this, tr("Choose file..."), QDir::homePath() + "/passwords.xml", "*.xml");
|
||||
|
||||
if (m_fileName.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QTimer::singleShot(0, this, SLOT(slotExportPasswords()));
|
||||
}
|
||||
|
||||
void AutoFillManager::slotImportPasswords()
|
||||
{
|
||||
QFile file(m_fileName);
|
||||
|
||||
if (!file.open(QFile::ReadOnly)) {
|
||||
ui->importExportLabel->setText(tr("Cannot read file!"));
|
||||
return;
|
||||
|
@ -298,14 +316,10 @@ void AutoFillManager::importPasswords()
|
|||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
void AutoFillManager::exportPasswords()
|
||||
void AutoFillManager::slotExportPasswords()
|
||||
{
|
||||
const QString &fileName = QFileDialog::getSaveFileName(this, tr("Choose file..."), QDir::homePath() + "/passwords.xml", "*.xml");
|
||||
if (fileName.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
QFile file(m_fileName);
|
||||
|
||||
QFile file(fileName);
|
||||
if (!file.open(QFile::WriteOnly)) {
|
||||
ui->importExportLabel->setText(tr("Cannot write to file!"));
|
||||
return;
|
||||
|
|
|
@ -55,10 +55,14 @@ private slots:
|
|||
void importPasswords();
|
||||
void exportPasswords();
|
||||
|
||||
void slotImportPasswords();
|
||||
void slotExportPasswords();
|
||||
|
||||
private:
|
||||
Ui::AutoFillManager* ui;
|
||||
|
||||
PasswordManager* m_passwordManager;
|
||||
QString m_fileName;
|
||||
bool m_passwordsShown;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user