434 Private method to load the recently opened project filenames. |
434 Private method to load the recently opened project filenames. |
435 """ |
435 """ |
436 self.recent = [] |
436 self.recent = [] |
437 Preferences.Prefs.rsettings.sync() |
437 Preferences.Prefs.rsettings.sync() |
438 rp = Preferences.Prefs.rsettings.value(recentNameProject) |
438 rp = Preferences.Prefs.rsettings.value(recentNameProject) |
439 if rp.isValid(): |
439 if rp is not None: |
440 for f in rp.toStringList(): |
440 for f in rp: |
441 if QFileInfo(f).exists(): |
441 if QFileInfo(f).exists(): |
442 self.recent.append(f) |
442 self.recent.append(f) |
443 |
443 |
444 def __saveRecent(self): |
444 def __saveRecent(self): |
445 """ |
445 """ |
446 Private method to save the list of recently opened filenames. |
446 Private method to save the list of recently opened filenames. |
447 """ |
447 """ |
448 Preferences.Prefs.rsettings.setValue(recentNameProject, QVariant(self.recent)) |
448 Preferences.Prefs.rsettings.setValue(recentNameProject, self.recent) |
449 Preferences.Prefs.rsettings.sync() |
449 Preferences.Prefs.rsettings.sync() |
450 |
450 |
451 def getMostRecent(self): |
451 def getMostRecent(self): |
452 """ |
452 """ |
453 Public method to get the most recently opened project. |
453 Public method to get the most recently opened project. |
3791 else: |
3791 else: |
3792 formatStr = '%d. %s' |
3792 formatStr = '%d. %s' |
3793 act = self.recentMenu.addAction(\ |
3793 act = self.recentMenu.addAction(\ |
3794 formatStr % (idx, |
3794 formatStr % (idx, |
3795 Utilities.compactPath(rp, self.ui.maxMenuFilePathLen))) |
3795 Utilities.compactPath(rp, self.ui.maxMenuFilePathLen))) |
3796 act.setData(QVariant(rp)) |
3796 act.setData(rp) |
3797 act.setEnabled(QFileInfo(rp).exists()) |
3797 act.setEnabled(QFileInfo(rp).exists()) |
3798 idx += 1 |
3798 idx += 1 |
3799 |
3799 |
3800 self.recentMenu.addSeparator() |
3800 self.recentMenu.addSeparator() |
3801 self.recentMenu.addAction(self.trUtf8('&Clear'), self.__clearRecent) |
3801 self.recentMenu.addAction(self.trUtf8('&Clear'), self.__clearRecent) |