File tree 4 files changed +13
-4
lines changed
4 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -214,7 +214,7 @@ FocusScope
214
214
anchors .left : rectTitleAndDataFile .left
215
215
anchors .right : parent .right
216
216
anchors .leftMargin : (10 * preferencesModel .uiScale ) + associatedDatafileImage .width
217
- text: model .dirpath
217
+ text: model .displayedpath
218
218
color: jaspTheme .textEnabled
219
219
horizontalAlignment: Text .AlignLeft
220
220
verticalAlignment: Text .AlignVCenter
Original file line number Diff line number Diff line change 24
24
#include " log.h"
25
25
#include " data/datasetpackage.h"
26
26
#include " mainwindow.h"
27
+ #include " utilities/appdirs.h"
27
28
28
29
FileMenu::FileMenu (QObject *parent) : QObject(parent)
29
30
{
@@ -255,11 +256,12 @@ void FileMenu::dataSetIOCompleted(FileEvent *event)
255
256
{
256
257
if (event->isSuccessful ())
257
258
{
258
- // don't add examples to the recent list
259
- if (!event->isReadOnly ())
259
+ // don't add database to the recent list
260
+ if (!event->isDatabase ())
260
261
{
261
262
_recentFiles->pushRecentFilePath (event->path ());
262
- _computer->addRecentFolder (event->path ());
263
+ if (!event->path ().startsWith (AppDirs::examples ()))
264
+ _computer->addRecentFolder (event->path ());
263
265
}
264
266
265
267
if (event->operation () == FileEvent::FileSave || (event->operation () == FileEvent::FileOpen && !event->isReadOnly ()))
Original file line number Diff line number Diff line change 4
4
#include < QTimer>
5
5
#include " log.h"
6
6
#include " jasptheme.h"
7
+ #include " utilities/appdirs.h"
7
8
8
9
FileMenuBasicListModel::FileMenuBasicListModel (QObject *parent, FileSystem * model) : QAbstractListModel(parent), _model(model)
9
10
{
@@ -41,12 +42,15 @@ QVariant FileMenuBasicListModel::data(const QModelIndex &index, int role) const
41
42
case IconSourceRole: return JaspTheme::currentIconPath () + FileSystemEntry::sourcesIcons ()[item.entryType ];
42
43
case DataIconSourceRole: return JaspTheme::currentIconPath () + FileSystemEntry::sourcesIcons ()[FileSystemEntry::CSV];
43
44
case DirRole:
45
+ case DisplayedPathRole:
44
46
{
45
47
if (QFileInfo (item.path ).path ().toLower ().startsWith (" http:" ) || QFileInfo (item.path ).path ().toLower ().startsWith (" https:" ))
46
48
return QFileInfo (item.path ).path ();
47
49
else
48
50
{
49
51
QString location = QDir::toNativeSeparators (QFileInfo (item.path ).path ()) ;
52
+ if (role == DisplayedPathRole && location.startsWith (AppDirs::examples ()))
53
+ location = location.mid (AppDirs::examples ().length () + 1 );
50
54
while (location.endsWith (QDir::separator ())) location.chop (1 );
51
55
return location + QDir::separator ();
52
56
}
@@ -76,6 +80,7 @@ bool FileMenuBasicListModel::setData(const QModelIndex &index, const QVariant &v
76
80
case AssociatedDataFileRole: item.associatedDataFile = value.toString (); break ;
77
81
case IconSourceRole: // Do nothing
78
82
case DataIconSourceRole:
83
+ case DisplayedPathRole:
79
84
case DirRole: break ;
80
85
}
81
86
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ enum FileMenuListItemType {
13
13
IconSourceRole ,
14
14
DataIconSourceRole ,
15
15
DirRole ,
16
+ DisplayedPathRole ,
16
17
ActionRole
17
18
};
18
19
@@ -25,6 +26,7 @@ const QHash<int, QByteArray> FileMenuListItemTypeRoleNames = {
25
26
{ IconSourceRole , "iconsource" },
26
27
{ DataIconSourceRole , "dataiconsource" },
27
28
{ DirRole , "dirpath" },
29
+ { DisplayedPathRole , "displayedpath" },
28
30
{ ActionRole , "action" }
29
31
};
30
32
You can’t perform that action at this time.
0 commit comments