1
/**************************************************************************
3
* Copyright 2015 Canonical Ltd.
4
* Copyright 2015 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: networklocation.h
22
#ifndef NETWORKLOCATION_H
23
#define NETWORKLOCATION_H
28
* \brief The NetworkLocation class is an Abstract class suitable for Network protocols easy browsing implementation
30
* Support to new protocols can have its browsing provided by this class and for the generic class \ref NetworkListWorker.
32
* To get the browsing working on a network protocol just create a new \ref Location class inherited from NetworkLocation,
33
* then provide both suitable classes \ref DirItemInfo and \ref descendant classes for this new \ref Location.
35
* The browsing itself will be performed inside a secondary thread using the \ref NetworkListWorker class.
37
*\note For this new \ref Location class it is also necessary:
38
* \li an enumerator item (the type) needs be added into Location::Locations
39
* \li the corresponding protocol URL need be registered in \ref LocationUrl
40
* \li an instance of this class needs to be created in the \ref LocationsFactory creator
42
* Minimal example of adding a new Location class the adds support to a new protocol in the File Manager:
45
* class NewLocation : public NetworkLocation
48
* explicit NewLocation(int type, QObject *parent=0) : NetworkLocation(type, parent) {}
52
* virtual DirItemInfo * newItemInfo(const QString& urlPath)
54
* //provide the suitable DirItemInfo inherited class here
57
* virtual LocationItemDirIterator * newDirIterator(const QString & path,
58
* QDir::Filters filters,
59
* QDirIterator::IteratorFlags flags = QDirIterator::NoIteratorFlags,
60
* LocationItemDirIterator::LoadMode loadmode = LocationItemDirIterator::LoadOnConstructor)
62
* //provide the suitable LocationItemDirIterator object for the new protocol here
65
* virtual LocationItemFile * newFile(const QString & path) { return 0; } //used only in Actions, browsing does not use it
66
* virtual LocationItemDir * newDir(const QString & dir = QLatin1String(0)) { return 0; } //used only in Actions, browsing does not use it
68
* virtual QString urlBelongsToLocation(const QString& urlPath, int indexOfColonAndSlash)
70
* // provide some kind of URL parsing for the new protocol, see other implementations
75
* \sa \ref SmbLocation, \ref SmbItemInfo, \ref SmbLocationDirIterator, \ref SmbLocationItemFile, \ref SmbLocationItemDir,
76
* \ref SmbLocationAuthentication , \ref NetAuthenticationData and \ref NetAuthenticationDataList
79
class NetworkLocation: public Location
82
explicit NetworkLocation(int type, QObject *parent=0);
84
virtual DirListWorker * newListWorker(const QString &urlPath,
86
const bool isRecursive);
89
#endif // NETWORKLOCATION_H