When switching to a library that does not exist, allow the user to abort the switch without forgetting the library. Fixes #1176364 ([Enhancement] Off-line Library)

This commit is contained in:
Kovid Goyal 2013-05-05 08:54:54 +05:30
parent e7268bc39f
commit 91bce0e175

View File

@ -116,11 +116,12 @@ class MovedDialog(QDialog): # {{{
self.cd.setIcon(QIcon(I('document_open.png'))) self.cd.setIcon(QIcon(I('document_open.png')))
self.cd.clicked.connect(self.choose_dir) self.cd.clicked.connect(self.choose_dir)
l.addWidget(self.cd, 2, 1, 1, 1) l.addWidget(self.cd, 2, 1, 1, 1)
self.bb = QDialogButtonBox(self) self.bb = QDialogButtonBox(QDialogButtonBox.Abort)
b = self.bb.addButton(_('Library moved'), self.bb.AcceptRole) b = self.bb.addButton(_('Library moved'), self.bb.AcceptRole)
b.setIcon(QIcon(I('ok.png'))) b.setIcon(QIcon(I('ok.png')))
b = self.bb.addButton(_('Forget library'), self.bb.RejectRole) b = self.bb.addButton(_('Forget library'), self.bb.RejectRole)
b.setIcon(QIcon(I('edit-clear.png'))) b.setIcon(QIcon(I('edit-clear.png')))
b.clicked.connect(self.forget_library)
self.bb.accepted.connect(self.accept) self.bb.accepted.connect(self.accept)
self.bb.rejected.connect(self.reject) self.bb.rejected.connect(self.reject)
l.addWidget(self.bb, 3, 0, 1, ncols) l.addWidget(self.bb, 3, 0, 1, ncols)
@ -132,9 +133,8 @@ class MovedDialog(QDialog): # {{{
if d is not None: if d is not None:
self.loc.setText(d) self.loc.setText(d)
def reject(self): def forget_library(self):
self.stats.remove(self.location) self.stats.remove(self.location)
QDialog.reject(self)
def accept(self): def accept(self):
newloc = unicode(self.loc.text()) newloc = unicode(self.loc.text())