diff options
Diffstat (limited to 'addon/doxywizard')
-rw-r--r-- | addon/doxywizard/doxywizard.cpp | 46 | ||||
-rw-r--r-- | addon/doxywizard/doxywizard.h | 1 |
2 files changed, 39 insertions, 8 deletions
diff --git a/addon/doxywizard/doxywizard.cpp b/addon/doxywizard/doxywizard.cpp index b746db1..329f60e 100644 --- a/addon/doxywizard/doxywizard.cpp +++ b/addon/doxywizard/doxywizard.cpp @@ -4,6 +4,8 @@ #include "expert.h" #include "wizard.h" +#define MAX_RECENT_FILES 10 + const int messageTimeout = 5000; //!< status bar message timeout in millisec. MainWindow &MainWindow::instance() @@ -31,6 +33,8 @@ MainWindow::MainWindow() this,SLOT(resetToDefaults())); settings->addAction(tr("Use current settings at startup"), this,SLOT(makeDefaults())); + settings->addAction(tr("Clear recent list"), + this,SLOT(clearRecent())); QMenu *help = menuBar()->addMenu(tr("Help")); help->addAction(tr("Online manual"), @@ -280,6 +284,25 @@ void MainWindow::makeDefaults() } } +void MainWindow::clearRecent() +{ + if (QMessageBox::question(this,tr("Clear the list of recent files?"), + tr("Do you want to clear the list of recently " + "loaded configuration files?"), + QMessageBox::Yes| + QMessageBox::Cancel)==QMessageBox::Yes) + { + m_recentMenu->clear(); + m_recentFiles.clear(); + for (int i=0;i<MAX_RECENT_FILES;i++) + { + m_settings.setValue(QString().sprintf("recent/config%d",i++),QString::fromAscii("")); + } + m_settings.sync(); + } + +} + void MainWindow::resetToDefaults() { if (QMessageBox::question(this,tr("Reset settings to their default values?"), @@ -310,17 +333,19 @@ void MainWindow::loadSettings() if (loadSettings!=QVariant::Invalid && loadSettings.toBool()) { m_expert->loadSettings(&m_settings); + if (workingDir!=QVariant::Invalid && QDir(workingDir.toString()).exists()) + { + setWorkingDir(workingDir.toString()); + } } - if (workingDir!=QVariant::Invalid && QDir(workingDir.toString()).exists()) - { - setWorkingDir(workingDir.toString()); - } - - for (int i=0;i<10;i++) + for (int i=0;i<MAX_RECENT_FILES;i++) { QString entry = m_settings.value(QString().sprintf("recent/config%d",i)).toString(); - if (!entry.isEmpty()) addRecentFile(entry); + if (!entry.isEmpty() && QFileInfo(entry).exists()) + { + addRecentFile(entry); + } } } @@ -346,7 +371,7 @@ void MainWindow::addRecentFile(const QString &fileName) if (i!=-1) m_recentFiles.removeAt(i); // not found - if (m_recentFiles.count() < 10) // append + if (m_recentFiles.count() < MAX_RECENT_FILES) // append { m_recentFiles.prepend(fileName); } @@ -362,6 +387,10 @@ void MainWindow::addRecentFile(const QString &fileName) m_recentMenu->addAction(str); m_settings.setValue(QString().sprintf("recent/config%d",i++),str); } + for (;i<MAX_RECENT_FILES;i++) + { + m_settings.setValue(QString().sprintf("recent/config%d",i++),QString::fromAscii("")); + } } void MainWindow::openRecent(QAction *action) @@ -489,6 +518,7 @@ void MainWindow::showHtmlOutput() { QString indexFile = m_expert->getHtmlOutputIndex(m_workingDir->text()); QFileInfo fi(indexFile); + // TODO: the following doesn't seem to work with IE #ifdef WIN32 QString indexUrl(QString::fromAscii("file:///")); #else diff --git a/addon/doxywizard/doxywizard.h b/addon/doxywizard/doxywizard.h index 49e13cc..46cd748 100644 --- a/addon/doxywizard/doxywizard.h +++ b/addon/doxywizard/doxywizard.h @@ -50,6 +50,7 @@ class MainWindow : public QMainWindow void saveLog(); void showSettings(); void configChanged(); + void clearRecent(); private: MainWindow(); |