diff --git a/src/calibre/gui2/actions/device.py b/src/calibre/gui2/actions/device.py index 1eb13c2c21..ab243d0797 100644 --- a/src/calibre/gui2/actions/device.py +++ b/src/calibre/gui2/actions/device.py @@ -183,6 +183,7 @@ class ConnectShareAction(InterfaceAction): popup_type = QToolButton.InstantPopup def genesis(self): + self.content_server_is_running = False self.share_conn_menu = ShareConnMenu(self.gui) self.share_conn_menu.aboutToShow.connect(self.set_smartdevice_action_state) self.share_conn_menu.toggle_server.connect(self.toggle_content_server) @@ -208,8 +209,10 @@ class ConnectShareAction(InterfaceAction): def content_server_state_changed(self, running): self.share_conn_menu.server_state_changed(running) if running: + self.content_server_is_running = True self.qaction.setIcon(QIcon(I('connect_share_on.png'))) else: + self.content_server_is_running = False self.qaction.setIcon(QIcon(I('connect_share.png'))) def toggle_content_server(self): @@ -285,5 +288,3 @@ class ConnectShareAction(InterfaceAction): ac = self.share_conn_menu.control_smartdevice_action ac.setIcon(QIcon(I('dot_%s.png'%icon))) ac.setText(text) - - diff --git a/src/calibre/gui2/dialogs/exim.py b/src/calibre/gui2/dialogs/exim.py index 80eddeda03..9e76ffa452 100644 --- a/src/calibre/gui2/dialogs/exim.py +++ b/src/calibre/gui2/dialogs/exim.py @@ -277,6 +277,14 @@ class EximDialog(Dialog): l.addStretch() def validate_import(self): + from calibre.gui2.ui import get_gui + g = get_gui() + if g is not None: + if g.iactions['Connect Share'].content_server_is_running: + error_dialog(self, _('Content Server running'), _( + 'Cannot import while the content server is running, shut it down first by clicking the' + ' Connect/share button on the calibre toolbar'), show=True) + return False if self.import_panel.stack.currentIndex() == 0: error_dialog(self, _('No folder selected'), _( 'You must select a folder containing the previously exported data that you wish to import'), show=True)