~ubuntu-filemanager-dev/ubuntu-filemanager-app/trunk

« back to all changes in this revision

Viewing changes to src/plugin/folderlistmodel/locationurl.cpp

  • Committer: Bileto Bot
  • Date: 2017-04-04 17:06:41 UTC
  • mfrom: (588.1.19 fix-desktop-file)
  • Revision ID: ci-train-bot@canonical.com-20170404170641-1p15lmx8wodlx2ut
* Rename binary file to ubuntu-filemanager-app
* Join plugin packages into the main package 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**************************************************************************
2
 
 *
3
 
 * Copyright 2014 Canonical Ltd.
4
 
 * Copyright 2014 Carlos J Mazieri <carlos.mazieri@gmail.com>
5
 
 *
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.
9
 
 *
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.
14
 
 *
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/>.
17
 
 *
18
 
 * File: locationurl.cpp
19
 
 * Date: 11/03/2014
20
 
 */
21
 
 
22
 
#include "locationurl.h"
23
 
#include <QUrl>
24
 
 
25
 
const QString LocationUrl::UrlIndicator("://");
26
 
 
27
 
const QString LocationUrl::TrashRootURL("trash:///");
28
 
const QString LocationUrl::DiskRootURL("file:///");
29
 
const QString LocationUrl::SmbURL("smb://");
30
 
const QString LocationUrl::CifsURL("cifs://");
31
 
#if 0
32
 
QString LocationURL::FishURL("fish:///");
33
 
#endif
34
 
                                                              // keep this list ordered
35
 
const QStringList LocationUrl::m_supportedURLs = QStringList() << LocationUrl::CifsURL
36
 
                                                               << LocationUrl::DiskRootURL
37
 
                                                               << LocationUrl::SmbURL
38
 
                                                               << LocationUrl::TrashRootURL
39
 
                                                               ;
40
 
 
41
 
LocationUrl::LocationUrl()
42
 
{
43
 
 
44
 
}
45
 
 
46
 
 
47
 
const QStringList& LocationUrl::supportedURLs()
48
 
{
49
 
   return m_supportedURLs;
50
 
}
51
 
 
52
 
 
53
 
bool LocationUrl::isSupportedUrl(const QUrl &url)
54
 
{
55
 
    bool ret = url.isValid() && url.isLocalFile(); // local files does not need to check
56
 
    if (!ret && !url.scheme().isEmpty())
57
 
    {
58
 
       int counter = m_supportedURLs.count();
59
 
       while (!ret && counter--)
60
 
       {
61
 
           ret = m_supportedURLs.at(counter).startsWith(url.scheme(), Qt::CaseSensitive);
62
 
       }
63
 
    }
64
 
    return ret;
65
 
}