Skip to content
Snippets Groups Projects
Commit e6360fd7 authored by Vincent Texier's avatar Vincent Texier
Browse files

Open automatically the imported account as current account

parent 940030a2
No related branches found
No related tags found
No related merge requests found
...@@ -336,7 +336,7 @@ class Application(QObject): ...@@ -336,7 +336,7 @@ class Application(QObject):
def import_account(self, file, name): def import_account(self, file, name):
''' '''
Import an account from a tar file Import an account from a tar file and open it
:param str file: The file path of the tar file :param str file: The file path of the tar file
:param str name: The account name :param str name: The account name
...@@ -359,6 +359,7 @@ class Application(QObject): ...@@ -359,6 +359,7 @@ class Application(QObject):
account.name = name account.name = name
self.add_account(account) self.add_account(account)
self.save(account) self.save(account)
self.change_current_account(account)
def export_account(self, file, account): def export_account(self, file, account):
''' '''
......
...@@ -101,6 +101,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): ...@@ -101,6 +101,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.open_ucoin_info = lambda: QDesktopServices.openUrl(QUrl("http://ucoin.io/theoretical/")) self.open_ucoin_info = lambda: QDesktopServices.openUrl(QUrl("http://ucoin.io/theoretical/"))
self.homescreen.button_info.clicked.connect(self.open_ucoin_info) self.homescreen.button_info.clicked.connect(self.open_ucoin_info)
self.import_dialog = None
self.export_dialog = None self.export_dialog = None
# TODO: There are too much refresh() calls on startup # TODO: There are too much refresh() calls on startup
...@@ -343,12 +344,16 @@ class MainWindow(QMainWindow, Ui_MainWindow): ...@@ -343,12 +344,16 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.refresh_contacts() self.refresh_contacts()
def import_account(self): def import_account(self):
dialog = ImportAccountDialog(self.app, self) self.import_dialog = ImportAccountDialog(self.app, self)
dialog.accepted.connect(self.refresh) self.import_dialog.accepted.connect(self.import_account_accepted)
dialog.exec_() self.import_dialog.exec_()
def import_account_accepted(self):
# open account after import
self.action_change_account(self.import_dialog.edit_name.text())
def export_account(self): def export_account(self):
# Testable way off using a QFileDialog # Testable way of using a QFileDialog
self.export_dialog = QFileDialog(self) self.export_dialog = QFileDialog(self)
self.export_dialog.setObjectName('ExportFileDialog') self.export_dialog.setObjectName('ExportFileDialog')
self.export_dialog.setWindowTitle(self.tr("Export an account")) self.export_dialog.setWindowTitle(self.tr("Export an account"))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment