diff -r 54632671aa3b -r f148796813d4 Plugins/VcsPlugins/vcsMercurial/FetchExtension/HgFetchDialog.py --- a/Plugins/VcsPlugins/vcsMercurial/FetchExtension/HgFetchDialog.py Sat Feb 11 18:19:56 2017 +0100 +++ b/Plugins/VcsPlugins/vcsMercurial/FetchExtension/HgFetchDialog.py Sat Feb 11 19:47:41 2017 +0100 @@ -14,27 +14,33 @@ from .Ui_HgFetchDialog import Ui_HgFetchDialog -import Preferences - class HgFetchDialog(QDialog, Ui_HgFetchDialog): """ Class implementing a dialog to enter data to be used for a fetch operation. """ - def __init__(self, parent=None): + def __init__(self, vcs, parent=None): """ Constructor - @param parent reference to the parent widget (QWidget) + @param vcs reference to the Mercurial vcs object + @type Hg + @param parent reference to the parent widget + @type QWidget """ super(HgFetchDialog, self).__init__(parent) self.setupUi(self) - self.recentCommitMessages = Preferences.toList( - Preferences.Prefs.settings.value('Mercurial/Commits')) + self.__vcs = vcs + + commitMessages = self.__vcs.getPlugin().getPreferences('Commits') self.recentComboBox.clear() self.recentComboBox.addItem("") - self.recentComboBox.addItems(self.recentCommitMessages) + for message in commitMessages: + abbrMsg = message[:60] + if len(message) > 60: + abbrMsg += "..." + self.recentComboBox.addItem(abbrMsg, message) @pyqtSlot(str) def on_recentComboBox_activated(self, txt): @@ -44,7 +50,7 @@ @param txt text of the selected entry (string) """ if txt: - self.messageEdit.setPlainText(txt) + self.messageEdit.setPlainText(self.recentComboBox.currentData()) def getData(self): """ @@ -55,14 +61,13 @@ """ msg = self.messageEdit.toPlainText() if msg: - if msg in self.recentCommitMessages: - self.recentCommitMessages.remove(msg) - self.recentCommitMessages.insert(0, msg) - no = int(Preferences.Prefs.settings.value( - 'Mercurial/CommitMessages', 20)) - del self.recentCommitMessages[no:] - Preferences.Prefs.settings.setValue( - 'Mercurial/Commits', - self.recentCommitMessages) + commitMessages = self.__vcs.getPlugin().getPreferences('Commits') + if msg in commitMessages: + commitMessages.remove(msg) + commitMessages.insert(0, msg) + no = self.__vcs.getPlugin().getPreferences("CommitMessages") + del commitMessages[no:] + self.__vcs.getPlugin().setPreferences( + 'Commits', commitMessages) return msg, self.switchCheckBox.isChecked()