prevent accidental sync, hide source ids

This commit is contained in:
Damien Elmes 2008-10-10 17:37:11 +09:00
parent 8739e164ac
commit 17798b03f4
3 changed files with 56 additions and 43 deletions

View file

@ -444,8 +444,8 @@ class AnkiQt(QMainWindow):
return
self.updateRecentFiles(self.deck.path)
if sync and self.config['syncOnLoad']:
self.syncDeck(False)
else:
if self.syncDeck(interactive=False):
return
try:
self.rebuildQueue()
except OperationalError:
@ -1019,9 +1019,10 @@ class AnkiQt(QMainWindow):
u=self.config['syncUsername']
p=self.config['syncPassword']
if not u or not p:
msg = _("Not syncing, username or password unset.")
return
if self.deck and not self.deck.syncName:
if interactive:
ui.utils.showWarning(msg)
self.onDeckProperties()
return
if self.deck is None and self.deckPath is None:
# qt on linux incorrectly accepts shortcuts for disabled actions

View file

@ -74,8 +74,8 @@ class Sync(QThread):
except SyncError, e:
return self.error(e)
else:
self.emit(SIGNAL("noMatchingDeck"), proxy.decks.keys(),
not self.onlyMerge)
keys = [k for (k,v) in proxy.decks.items() if v[1] != -1]
self.emit(SIGNAL("noMatchingDeck"), keys, not self.onlyMerge)
self.setStatus("")
return
timediff = abs(proxy.timestamp - time.time())
@ -115,17 +115,18 @@ class Sync(QThread):
self.setStatus(_("No changes found."))
# check sources
if self.sourcesToCheck:
start = time.time()
self.setStatus(_("<br><br>Checking deck subscriptions.."))
for source in self.sourcesToCheck:
proxy.deckName = str(source)
msg = "%s:" % client.syncOneWayDeckName()
if not proxy.hasDeck(str(source)):
self.setStatus(_("%s no longer exists.") % msg)
self.setStatus(_(" * %s no longer exists.") % msg)
continue
if not client.prepareOneWaySync():
self.setStatus(_("%s no changes found.") % msg)
self.setStatus(_(" * %s no changes found.") % msg)
continue
self.setStatus(_("%s fetching payload..") % msg)
self.setStatus(_(" * %s fetching payload..") % msg)
payload = proxy.genOneWayPayload(client.lastSync)
self.setStatus(msg + _(" applied %d modified cards.") %
len(payload['cards']))

View file

@ -8,15 +8,15 @@
<rect>
<x>0</x>
<y>0</y>
<width>429</width>
<height>451</height>
<width>366</width>
<height>408</height>
</rect>
</property>
<property name="windowTitle" >
<string>Deck Properties</string>
</property>
<layout class="QGridLayout" name="gridLayout_5" >
<item row="0" column="0" >
<layout class="QVBoxLayout" name="verticalLayout_2" >
<item>
<widget class="QTabWidget" name="qtabwidget" >
<property name="whatsThis" >
<string>&lt;a href="http://ichi2.net/anki/wiki/DeckProperties#Synchronization">Help&lt;/a></string>
@ -29,8 +29,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>407</width>
<height>373</height>
<width>350</width>
<height>342</height>
</rect>
</property>
<attribute name="title" >
@ -58,17 +58,7 @@
<item row="1" column="0" >
<widget class="QCheckBox" name="doSync" >
<property name="text" >
<string>Synchronize this deck with name:</string>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLineEdit" name="syncName" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="whatsThis" >
<string>option</string>
<string>Synchronize this deck</string>
</property>
</widget>
</item>
@ -123,6 +113,27 @@ p, li { white-space: pre-wrap; }
</property>
</spacer>
</item>
<item row="2" column="0" >
<layout class="QHBoxLayout" name="horizontalLayout_2" >
<item>
<widget class="QLabel" name="label_18" >
<property name="text" >
<string>Name on server: </string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="syncName" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="whatsThis" >
<string>option</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
@ -132,8 +143,8 @@ p, li { white-space: pre-wrap; }
<rect>
<x>0</x>
<y>0</y>
<width>413</width>
<height>385</height>
<width>350</width>
<height>342</height>
</rect>
</property>
<attribute name="title" >
@ -329,8 +340,8 @@ p, li { white-space: pre-wrap; }
<rect>
<x>0</x>
<y>0</y>
<width>413</width>
<height>385</height>
<width>350</width>
<height>342</height>
</rect>
</property>
<attribute name="title" >
@ -394,8 +405,8 @@ p, li { white-space: pre-wrap; }
<rect>
<x>0</x>
<y>0</y>
<width>413</width>
<height>385</height>
<width>350</width>
<height>342</height>
</rect>
</property>
<attribute name="title" >
@ -435,8 +446,8 @@ p, li { white-space: pre-wrap; }
<rect>
<x>0</x>
<y>0</y>
<width>413</width>
<height>385</height>
<width>350</width>
<height>342</height>
</rect>
</property>
<attribute name="title" >
@ -627,7 +638,7 @@ p, li { white-space: pre-wrap; }
</widget>
</widget>
</item>
<item row="2" column="0" >
<item>
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>