[Kst] branches/work/kst/portto4/kst/src/libkstapp
Nicolas Brisset
nicolas.brisset at eurocopter.com
Sun Jun 2 15:13:05 UTC 2013
SVN commit 1356805 by brisset:
Fixes to the recently opened files stuff I committed yesterday:
- avoid adding the current dir when kst2 is called without args
- in Document::initFromCommandLine, take the call to _win->updateRecentKstFiles(kstfile) out of the if
(dataPlotted) if block as this does not seem to work. Barth, I think you should check that (see line 206 of
document.cpp), as dataPlotted is set to the return value of Document::open() which returns _isOpen. Sounds
strange...
It seems to work correctly now, the doubts I had were because I was confused due to some old paths stored in
the history prior to getting it to work correctly.
M +1 -1 document.cpp
M +6 -2 mainwindow.cpp
--- branches/work/kst/portto4/kst/src/libkstapp/document.cpp #1356804:1356805
@@ -203,11 +203,11 @@
QString kstfile = P->kstFileName();
if (!kstfile.isEmpty()) {
dataPlotted = open(kstfile);
+ _win->updateRecentKstFiles(kstfile);
if (dataPlotted) {
UpdateManager::self()->doUpdates(true);
setChanged(false);
- _win->updateRecentKstFiles(kstfile);
}
}
}
--- branches/work/kst/portto4/kst/src/libkstapp/mainwindow.cpp #1356804:1356805
@@ -74,6 +74,7 @@
#include <QMessageBox>
#include <QImageWriter>
#include <QToolBar>
+#include <QDebug>
namespace Kst {
@@ -351,7 +352,10 @@
void MainWindow::updateRecentFiles(const QString& key, QMenu* menu, QList<QAction*>& actions, QMenu* submenu, const QString& newfilename, const char* openslot)
{
// Always add absolute paths to the recent file lists, otherwise they are not very reusable
- QString absoluteFilePath = newfilename.startsWith("/") ? newfilename : QDir::currentPath() + "/" + newfilename;
+ QString absoluteFilePath = newfilename;
+ if (!newfilename.isEmpty() && !newfilename.startsWith("/")) { // If it's not empty and not absolute either, add the dir
+ absoluteFilePath = QDir::currentPath() + "/" + newfilename;
+ }
foreach(QAction* it, actions) {
menu->removeAction(it);
delete it;
@@ -381,7 +385,7 @@
foreach(const QString& it, recentFiles) {
i++;
if (i <= 5) {
- // don't make file menu to wide, show complete path in statusbar
+ // don't make file menu too wide, show complete path in statusbar
QAction* action = createRecentFileAction(it, i, QFileInfo(it).fileName(), openslot);
actions << action;
menu->addAction(action);
More information about the Kst
mailing list