| 3113 | |
| 3114 | |
| 3115 | void Window::updateRecentFileActions() |
| 3116 | // ---------------------------------------------------------------------------- |
| 3117 | // Update the recent files menu (file names are read from settings) |
| 3118 | // ---------------------------------------------------------------------------- |
| 3119 | { |
| 3120 | QSettings settings; |
| 3121 | QStringList files = settings.value("recentFileList").toStringList(); |
| 3122 | |
| 3123 | files.removeAll(""); |
| 3124 | int numRecentFiles = qMin(files.size(), (int)MaxRecentFiles); |
| 3125 | |
| 3126 | for (int i = 0; i < numRecentFiles; ++i) { |
| 3127 | QString nat = QDir::toNativeSeparators(files[i]); |
| 3128 | #ifdef CONFIG_MACOSX |
| 3129 | QString text = nat; |
| 3130 | #else |
| 3131 | QString text = tr("&%1 %2").arg(i + 1).arg(nat); |
| 3132 | #endif |
| 3133 | recentFileActs[i]->setText(text); |
| 3134 | recentFileActs[i]->setData(files[i]); |
| 3135 | recentFileActs[i]->setToolTip(files[i]); |
| 3136 | recentFileActs[i]->setVisible(true); |
| 3137 | } |
| 3138 | for (int j = numRecentFiles; j < MaxRecentFiles; ++j) |
| 3139 | recentFileActs[j]->setVisible(false); |
| 3140 | |
| 3141 | clearRecentAct->setEnabled(numRecentFiles > 0); |
| 3142 | } |
| 3143 | |
| 3144 | |
| 3145 | Window *Window::findWindow(const QString &fileName) |
no test coverage detected