98 Private method to load the recently opened multi project filenames. |
98 Private method to load the recently opened multi project filenames. |
99 """ |
99 """ |
100 self.recent = [] |
100 self.recent = [] |
101 Preferences.Prefs.rsettings.sync() |
101 Preferences.Prefs.rsettings.sync() |
102 rp = Preferences.Prefs.rsettings.value(recentNameMultiProject) |
102 rp = Preferences.Prefs.rsettings.value(recentNameMultiProject) |
103 if rp.isValid(): |
103 if rp is not None: |
104 for f in rp.toStringList(): |
104 for f in rp: |
105 if QFileInfo(f).exists(): |
105 if QFileInfo(f).exists(): |
106 self.recent.append(f) |
106 self.recent.append(f) |
107 |
107 |
108 def __saveRecent(self): |
108 def __saveRecent(self): |
109 """ |
109 """ |
110 Private method to save the list of recently opened filenames. |
110 Private method to save the list of recently opened filenames. |
111 """ |
111 """ |
112 Preferences.Prefs.rsettings.setValue(recentNameMultiProject, |
112 Preferences.Prefs.rsettings.setValue(recentNameMultiProject, self.recent) |
113 QVariant(self.recent)) |
|
114 Preferences.Prefs.rsettings.sync() |
113 Preferences.Prefs.rsettings.sync() |
115 |
114 |
116 def getMostRecent(self): |
115 def getMostRecent(self): |
117 """ |
116 """ |
118 Public method to get the most recently opened multiproject. |
117 Public method to get the most recently opened multiproject. |
860 else: |
859 else: |
861 formatStr = '%d. %s' |
860 formatStr = '%d. %s' |
862 act = self.recentMenu.addAction(\ |
861 act = self.recentMenu.addAction(\ |
863 formatStr % (idx, |
862 formatStr % (idx, |
864 Utilities.compactPath(rp, self.ui.maxMenuFilePathLen))) |
863 Utilities.compactPath(rp, self.ui.maxMenuFilePathLen))) |
865 act.setData(QVariant(rp)) |
864 act.setData(rp) |
866 act.setEnabled(QFileInfo(rp).exists()) |
865 act.setEnabled(QFileInfo(rp).exists()) |
867 idx += 1 |
866 idx += 1 |
868 |
867 |
869 self.recentMenu.addSeparator() |
868 self.recentMenu.addSeparator() |
870 self.recentMenu.addAction(self.trUtf8('&Clear'), self.__clearRecent) |
869 self.recentMenu.addAction(self.trUtf8('&Clear'), self.__clearRecent) |
874 Private method to open a multi project from the list of rencently |
873 Private method to open a multi project from the list of rencently |
875 opened multi projects. |
874 opened multi projects. |
876 |
875 |
877 @param act reference to the action that triggered (QAction) |
876 @param act reference to the action that triggered (QAction) |
878 """ |
877 """ |
879 file = act.data().toString() |
878 file = act.data() |
880 if file: |
879 if file: |
881 self.openMultiProject(file) |
880 self.openMultiProject(file) |
882 |
881 |
883 def __clearRecent(self): |
882 def __clearRecent(self): |
884 """ |
883 """ |