diff options
Diffstat (limited to 'src/tikzit.cpp')
-rw-r--r-- | src/tikzit.cpp | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/src/tikzit.cpp b/src/tikzit.cpp index e12053b..e81706c 100644 --- a/src/tikzit.cpp +++ b/src/tikzit.cpp @@ -276,16 +276,28 @@ void Tikzit::open(QString fileName) if (!fileName.isEmpty()) { if (_windows.size() == 1 && _windows[0]->tikzDocument()->isClean() && - _windows[0]->tikzDocument()->shortName().isEmpty()) - { + _windows[0]->tikzDocument()->shortName().isEmpty()) + { _windows[0]->open(fileName); _windows[0]->show(); - } - else { - MainWindow *w = new MainWindow(); - w->show(); - w->open(fileName); - _windows << w; + } + else + { + bool found = false; + foreach (MainWindow *w, _windows) { + if (w->tikzDocument()->fileName() == fileName) { + w->raise(); + w->activateWindow(); + found = true; + } + } + + if (!found) { + MainWindow *w = new MainWindow(); + _windows << w; + w->show(); + w->open(fileName); + } } } } @@ -354,6 +366,20 @@ QString Tikzit::styleFilePath() const return _styleFilePath; } +void Tikzit::updateRecentFiles() +{ + foreach (MainWindow *w, _windows) { + w->menu()->updateRecentFiles(); + } +} + +void Tikzit::clearRecentFiles() +{ + QSettings settings("tikzit", "tikzit"); + settings.setValue("recent-files", QStringList()); + updateRecentFiles(); +} + void Tikzit::setCheckForUpdates(bool check) { QSettings settings("tikzit", "tikzit"); |