add option to force full sync

This commit is contained in:
Damien Elmes 2012-04-12 19:01:45 +09:00
parent be35f33301
commit 7fca98092c
2 changed files with 18 additions and 0 deletions

View file

@ -58,6 +58,7 @@ class AnkiQt(QMainWindow):
def setupUI(self): def setupUI(self):
self.col = None self.col = None
self.state = "overview" self.state = "overview"
self.forceFullSync = False
self.setupKeys() self.setupKeys()
self.setupThreads() self.setupThreads()
self.setupMainWindow() self.setupMainWindow()
@ -504,6 +505,13 @@ Debug info:\n%s""") % traceback.format_exc(), help="DeckErrors")
if not self.col: if not self.col:
self.loadCollection() self.loadCollection()
def onFullSync(self):
self.forceFullSync = True
self.col.modSchema()
self.col.setMod()
self.forceFullSync = False
self.onSync()
# Tools # Tools
########################################################################## ##########################################################################
@ -799,6 +807,7 @@ Debug info:\n%s""") % traceback.format_exc(), help="DeckErrors")
self.connect(m.actionCheckMediaDatabase, s, self.onCheckMediaDB) self.connect(m.actionCheckMediaDatabase, s, self.onCheckMediaDB)
self.connect(m.actionDocumentation, s, self.onDocumentation) self.connect(m.actionDocumentation, s, self.onDocumentation)
self.connect(m.actionDonate, s, self.onDonate) self.connect(m.actionDonate, s, self.onDonate)
self.connect(m.actionFullSync, s, self.onFullSync)
def updateTitleBar(self): def updateTitleBar(self):
self.setWindowTitle("Anki") self.setWindowTitle("Anki")
@ -847,6 +856,9 @@ the problem and restart Anki.""")
# if triggered in sync, make sure we don't use the gui # if triggered in sync, make sure we don't use the gui
if not self.inMainThread(): if not self.inMainThread():
return True return True
# if from the full sync menu, ignore
if self.forceFullSync:
return True
return askUser(_("""\ return askUser(_("""\
The requested change will require a full upload of the database when \ The requested change will require a full upload of the database when \
you next synchronize your collection. If you have reviews or other changes \ you next synchronize your collection. If you have reviews or other changes \

View file

@ -105,6 +105,7 @@
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionFullDatabaseCheck"/> <addaction name="actionFullDatabaseCheck"/>
<addaction name="actionCheckMediaDatabase"/> <addaction name="actionCheckMediaDatabase"/>
<addaction name="actionFullSync"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="menuPlugins"/> <addaction name="menuPlugins"/>
<addaction name="separator"/> <addaction name="separator"/>
@ -243,6 +244,11 @@
<string>Ctrl+I</string> <string>Ctrl+I</string>
</property> </property>
</action> </action>
<action name="actionFullSync">
<property name="text">
<string>Full Sync...</string>
</property>
</action>
</widget> </widget>
<resources> <resources>
<include location="icons.qrc"/> <include location="icons.qrc"/>