Merge pull request #417 from seatedscribe/feature/csv-import-button

Adds a button for CSV import option
This commit is contained in:
TheZ3ro 2017-03-25 21:26:30 +01:00 committed by GitHub
commit e0c6981b40
5 changed files with 32 additions and 11 deletions

View File

@ -301,6 +301,7 @@ MainWindow::MainWindow()
connect(m_ui->welcomeWidget, SIGNAL(openDatabase()), SLOT(switchToOpenDatabase()));
connect(m_ui->welcomeWidget, SIGNAL(openDatabaseFile(QString)), SLOT(switchToDatabaseFile(QString)));
connect(m_ui->welcomeWidget, SIGNAL(importKeePass1Database()), SLOT(switchToKeePass1Database()));
connect(m_ui->welcomeWidget, SIGNAL(importCsv()), SLOT(switchToImportCsv()));
connect(m_ui->actionAbout, SIGNAL(triggered()), SLOT(showAboutDialog()));
@ -605,6 +606,12 @@ void MainWindow::switchToKeePass1Database()
switchToDatabases();
}
void MainWindow::switchToImportCsv()
{
m_ui->tabWidget->importCsv();
switchToDatabases();
}
void MainWindow::databaseStatusChanged(DatabaseWidget *)
{
updateTrayIcon();

View File

@ -65,6 +65,7 @@ private slots:
void switchToOpenDatabase();
void switchToDatabaseFile(QString file);
void switchToKeePass1Database();
void switchToImportCsv();
void closePasswordGen();
void databaseStatusChanged(DatabaseWidget *dbWidget);
void databaseTabChanged(int tabIndex);

View File

@ -51,6 +51,7 @@ WelcomeWidget::WelcomeWidget(QWidget* parent)
connect(m_ui->buttonNewDatabase, SIGNAL(clicked()), SIGNAL(newDatabase()));
connect(m_ui->buttonOpenDatabase, SIGNAL(clicked()), SIGNAL(openDatabase()));
connect(m_ui->buttonImportKeePass1, SIGNAL(clicked()), SIGNAL(importKeePass1Database()));
connect(m_ui->buttonImportCSV, SIGNAL(clicked()), SIGNAL(importCsv()));
connect(m_ui->recentListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this,
SLOT(openDatabaseFromFile(QListWidgetItem*)));
}
@ -65,4 +66,4 @@ void WelcomeWidget::openDatabaseFromFile(QListWidgetItem* item)
return;
}
emit openDatabaseFile(item->text());
}
}

View File

@ -34,13 +34,14 @@ public:
~WelcomeWidget();
signals:
void newDatabase();
void openDatabase();
void openDatabaseFile(QString);
void importKeePass1Database();
void newDatabase();
void openDatabase();
void openDatabaseFile(QString);
void importKeePass1Database();
void importCsv();
private slots:
void openDatabaseFromFile(QListWidgetItem* item);
void openDatabaseFromFile(QListWidgetItem* item);
private:
const QScopedPointer<Ui::WelcomeWidget> m_ui;

View File

@ -121,11 +121,22 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonImportKeePass1">
<property name="text">
<string>Import from KeePass 1</string>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="buttonImportKeePass1">
<property name="text">
<string>Import from KeePass 1</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonImportCSV">
<property name="text">
<string>Import from CSV</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">