mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-02-07 12:05:14 +01:00
Added support for file scheme URIs
This commit is contained in:
parent
213ab73ceb
commit
319cdbf838
@ -11,7 +11,7 @@ Comment[ru]=Программа для просмотра и анализа GPS
|
|||||||
Comment[sv]=GPS-loggfilsläsare och analysator
|
Comment[sv]=GPS-loggfilsläsare och analysator
|
||||||
Comment[tr]=GPS günlük dosyası görüntüleyici ve analizcisi
|
Comment[tr]=GPS günlük dosyası görüntüleyici ve analizcisi
|
||||||
Comment[uk]=Переглядач та аналізатор GPS логів
|
Comment[uk]=Переглядач та аналізатор GPS логів
|
||||||
Exec=gpxsee %F
|
Exec=gpxsee %U
|
||||||
Icon=gpxsee
|
Icon=gpxsee
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Type=Application
|
Type=Application
|
||||||
|
@ -1069,6 +1069,8 @@ void GUI::openDir()
|
|||||||
|
|
||||||
bool GUI::openFile(const QString &fileName, bool tryUnknown, int &showError)
|
bool GUI::openFile(const QString &fileName, bool tryUnknown, int &showError)
|
||||||
{
|
{
|
||||||
|
QString path;
|
||||||
|
|
||||||
QUrl url(fileName);
|
QUrl url(fileName);
|
||||||
if (url.scheme() == "geo") {
|
if (url.scheme() == "geo") {
|
||||||
if (loadURL(url, showError)) {
|
if (loadURL(url, showError)) {
|
||||||
@ -1077,20 +1079,23 @@ bool GUI::openFile(const QString &fileName, bool tryUnknown, int &showError)
|
|||||||
return true;
|
return true;
|
||||||
} else if (showError)
|
} else if (showError)
|
||||||
return false;
|
return false;
|
||||||
}
|
} else if (url.isLocalFile())
|
||||||
|
path = url.toLocalFile();
|
||||||
|
else
|
||||||
|
path = fileName;
|
||||||
|
|
||||||
QFileInfo fi(fileName);
|
QFileInfo fi(path);
|
||||||
QString canonicalFileName(fi.canonicalFilePath());
|
QString canonicalPath(fi.canonicalFilePath());
|
||||||
|
|
||||||
if (_files.contains(canonicalFileName))
|
if (_files.contains(canonicalPath))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!loadFile(fileName, tryUnknown, showError))
|
if (!loadFile(path, tryUnknown, showError))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
_files.append(canonicalFileName);
|
_files.append(canonicalPath);
|
||||||
#ifndef Q_OS_ANDROID
|
#ifndef Q_OS_ANDROID
|
||||||
_browser->setCurrent(fileName);
|
_browser->setCurrent(path);
|
||||||
#endif // Q_OS_ANDROID
|
#endif // Q_OS_ANDROID
|
||||||
_fileActionGroup->setEnabled(true);
|
_fileActionGroup->setEnabled(true);
|
||||||
// Explicitly enable the reload action as it may be disabled by loadMapDir()
|
// Explicitly enable the reload action as it may be disabled by loadMapDir()
|
||||||
@ -1103,7 +1108,7 @@ bool GUI::openFile(const QString &fileName, bool tryUnknown, int &showError)
|
|||||||
if (_files.count() > 1)
|
if (_files.count() > 1)
|
||||||
_mapView->showExtendedInfo(true);
|
_mapView->showExtendedInfo(true);
|
||||||
#ifndef Q_OS_ANDROID
|
#ifndef Q_OS_ANDROID
|
||||||
updateRecentFiles(canonicalFileName);
|
updateRecentFiles(canonicalPath);
|
||||||
#endif // Q_OS_ANDROID
|
#endif // Q_OS_ANDROID
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -1890,7 +1895,13 @@ bool GUI::loadMapNode(const TreeNode<Map*> &node, MapAction *&action,
|
|||||||
|
|
||||||
bool GUI::loadMap(const QString &fileName, MapAction *&action, int &showError)
|
bool GUI::loadMap(const QString &fileName, MapAction *&action, int &showError)
|
||||||
{
|
{
|
||||||
TreeNode<Map*> maps(MapList::loadMaps(fileName, _mapView->inputProjection()));
|
QString path;
|
||||||
|
QUrl url(fileName);
|
||||||
|
|
||||||
|
path = url.isLocalFile() ? url.toLocalFile() : fileName;
|
||||||
|
|
||||||
|
|
||||||
|
TreeNode<Map*> maps(MapList::loadMaps(path, _mapView->inputProjection()));
|
||||||
QList<QAction*> existingActions(_mapsActionGroup->actions());
|
QList<QAction*> existingActions(_mapsActionGroup->actions());
|
||||||
|
|
||||||
return loadMapNode(maps, action, existingActions, showError);
|
return loadMapNode(maps, action, existingActions, showError);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user