Skip to content

Commit efd5cc5

Browse files
committedAug 3, 2018
[FEATURE] Add Open Directory option to disabled welcome page projects
This allows users to open the closest existing path to the original project location in their file manager, to hopefully help them re-locate missing/moved/renamed projects.
1 parent 22c4284 commit efd5cc5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
 

‎src/app/qgswelcomepage.cpp‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,16 @@ void QgsWelcomePage::showContextMenuForProjects( QPoint point )
166166
mModel->recheckProject( index );
167167
} );
168168
menu->addAction( rescanAction );
169+
170+
// add an entry to open the closest existing path to the original project file location
171+
// to help users re-find moved/renamed projects!
172+
const QString closestPath = QgsFileUtils::findClosestExistingPath( path );
173+
QAction *openFolderAction = new QAction( tr( "Open “%1”…" ).arg( QDir::toNativeSeparators( closestPath ) ), menu );
174+
connect( openFolderAction, &QAction::triggered, this, [closestPath]
175+
{
176+
QDesktopServices::openUrl( QUrl::fromLocalFile( closestPath ) );
177+
} );
178+
menu->addAction( openFolderAction );
169179
}
170180
QAction *removeProjectAction = new QAction( tr( "Remove from List" ), menu );
171181
connect( removeProjectAction, &QAction::triggered, this, [this, index]

0 commit comments

Comments
 (0)
Please sign in to comment.