diff --git a/src/app/qgsprojectlistitemdelegate.cpp b/src/app/qgsprojectlistitemdelegate.cpp
index 523e0d1d1212..8cfe05786e43 100644
--- a/src/app/qgsprojectlistitemdelegate.cpp
+++ b/src/app/qgsprojectlistitemdelegate.cpp
@@ -80,7 +80,7 @@ void QgsProjectListItemDelegate::paint( QPainter *painter, const QStyleOptionVie
doc.setHtml( QStringLiteral( "
%3%4
%5
%6
" ).arg( textSize ).arg( QString::number( titleSize ),
index.data( QgsProjectListItemDelegate::TitleRole ).toString(),
index.data( QgsProjectListItemDelegate::PinRole ).toBool() ? QStringLiteral( "" ) : QString(),
- mShowPath ? index.data( QgsProjectListItemDelegate::NativePathRole ).toString() : QString(),
+ mShowPath ? index.data( QgsProjectListItemDelegate::AnonymisedNativePathRole ).toString() : QString(),
index.data( QgsProjectListItemDelegate::CrsRole ).toString() ) );
doc.setTextWidth( option.rect.width() - ( !icon.isNull() ? iconSize.width() + 4.375 * mRoundedRectSizePixels : 4.375 * mRoundedRectSizePixels ) );
diff --git a/src/app/qgsprojectlistitemdelegate.h b/src/app/qgsprojectlistitemdelegate.h
index 87e7ba2f38ad..becf3209610e 100644
--- a/src/app/qgsprojectlistitemdelegate.h
+++ b/src/app/qgsprojectlistitemdelegate.h
@@ -46,7 +46,8 @@ class QgsProjectListItemDelegate : public QStyledItemDelegate
PathRole = Qt::UserRole + 2,
NativePathRole = Qt::UserRole + 3,
CrsRole = Qt::UserRole + 4,
- PinRole = Qt::UserRole + 5
+ PinRole = Qt::UserRole + 5,
+ AnonymisedNativePathRole = Qt::UserRole + 6
};
explicit QgsProjectListItemDelegate( QObject *parent = nullptr );
diff --git a/src/app/qgsrecentprojectsitemsmodel.cpp b/src/app/qgsrecentprojectsitemsmodel.cpp
index c6ca699ac0cb..7861e2329002 100644
--- a/src/app/qgsrecentprojectsitemsmodel.cpp
+++ b/src/app/qgsrecentprojectsitemsmodel.cpp
@@ -21,6 +21,7 @@
#include "qgsprojectstorageregistry.h"
#include "qgsprojectlistitemdelegate.h"
#include "qgsprojectstorage.h"
+#include "qgsdatasourceuri.h"
#include
#include
@@ -88,7 +89,16 @@ QVariant QgsRecentProjectItemsModel::data( const QModelIndex &index, int role )
}
case Qt::ToolTipRole:
- return mRecentProjects.at( index.row() ).path;
+ case QgsProjectListItemDelegate::AnonymisedNativePathRole:
+ {
+ QString name = mRecentProjects.at( index.row() ).path;
+ QgsProjectStorage *storage = QgsApplication::projectStorageRegistry()->projectStorageFromUri( name );
+ if ( storage )
+ {
+ name = QgsDataSourceUri::removePassword( name, true );
+ }
+ return name;
+ }
default:
return QVariant();
diff --git a/src/app/qgswelcomepage.cpp b/src/app/qgswelcomepage.cpp
index 57911e223d4d..02dfc8726aef 100644
--- a/src/app/qgswelcomepage.cpp
+++ b/src/app/qgswelcomepage.cpp
@@ -207,7 +207,7 @@ QgsRecentProjectItemsModel *QgsWelcomePage::recentProjectsModel()
void QgsWelcomePage::recentProjectItemActivated( const QModelIndex &index )
{
- QgisApp::instance()->openProject( mRecentProjectsModel->data( index, Qt::ToolTipRole ).toString() );
+ QgisApp::instance()->openProject( mRecentProjectsModel->data( index, QgsProjectListItemDelegate::PathRole ).toString() );
}
void QgsWelcomePage::templateProjectItemActivated( const QModelIndex &index )