1
/**************************************************************************
3
* Copyright 2014 Canonical Ltd.
4
* Copyright 2014 Carlos J Mazieri <carlos.mazieri@gmail.com>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU Lesser General Public License as published by
8
* the Free Software Foundation; version 3.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU Lesser General Public License for more details.
15
* You should have received a copy of the GNU Lesser General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18
* File: locationurl.cpp
22
#include "locationurl.h"
25
const QString LocationUrl::UrlIndicator("://");
27
const QString LocationUrl::TrashRootURL("trash:///");
28
const QString LocationUrl::DiskRootURL("file:///");
29
const QString LocationUrl::SmbURL("smb://");
30
const QString LocationUrl::CifsURL("cifs://");
32
QString LocationURL::FishURL("fish:///");
34
// keep this list ordered
35
const QStringList LocationUrl::m_supportedURLs = QStringList() << LocationUrl::CifsURL
36
<< LocationUrl::DiskRootURL
37
<< LocationUrl::SmbURL
38
<< LocationUrl::TrashRootURL
41
LocationUrl::LocationUrl()
47
const QStringList& LocationUrl::supportedURLs()
49
return m_supportedURLs;
53
bool LocationUrl::isSupportedUrl(const QUrl &url)
55
bool ret = url.isValid() && url.isLocalFile(); // local files does not need to check
56
if (!ret && !url.scheme().isEmpty())
58
int counter = m_supportedURLs.count();
59
while (!ret && counter--)
61
ret = m_supportedURLs.at(counter).startsWith(url.scheme(), Qt::CaseSensitive);