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

« back to all changes in this revision

Viewing changes to src/plugin/folderlistmodel/networklocation.h

  • 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 2015 Canonical Ltd.
 
4
 * Copyright 2015 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: networklocation.h
 
19
 * Date: 08/12/2015
 
20
 */
 
21
 
 
22
#ifndef NETWORKLOCATION_H
 
23
#define NETWORKLOCATION_H
 
24
 
 
25
#include "location.h"
 
26
 
 
27
/*!
 
28
 * \brief The NetworkLocation class is an Abstract class suitable for Network protocols easy browsing implementation
 
29
 *
 
30
 * Support to new protocols can have its browsing provided by this class and for the generic class \ref NetworkListWorker.
 
31
 *
 
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.
 
34
 *
 
35
 * The browsing itself will be performed inside a secondary thread using the \ref NetworkListWorker class.
 
36
 *
 
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
 
41
 *
 
42
 * Minimal example of adding a new Location class the adds support to a new protocol in the File Manager:
 
43
 *\code
 
44
 *
 
45
 *  class NewLocation : public NetworkLocation
 
46
 *  {
 
47
 *  public:
 
48
 *      explicit NewLocation(int type, QObject *parent=0) : NetworkLocation(type, parent) {}
 
49
 *      ~NewLocation() {}
 
50
 *
 
51
 *  public:
 
52
 *      virtual DirItemInfo * newItemInfo(const QString& urlPath)
 
53
 *      {
 
54
 *          //provide the suitable DirItemInfo inherited class here
 
55
 *      }
 
56
 *
 
57
 *      virtual LocationItemDirIterator * newDirIterator(const QString & path,
 
58
 *                                                        QDir::Filters filters,
 
59
 *                                                        QDirIterator::IteratorFlags flags = QDirIterator::NoIteratorFlags,
 
60
 *                                                        LocationItemDirIterator::LoadMode loadmode = LocationItemDirIterator::LoadOnConstructor)
 
61
 *      {
 
62
 *        //provide the suitable LocationItemDirIterator object for the new protocol here
 
63
 *      }
 
64
 *
 
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
 
67
 *
 
68
 *      virtual QString     urlBelongsToLocation(const QString& urlPath, int indexOfColonAndSlash)
 
69
 *      {
 
70
 *          // provide some kind of URL parsing for the new protocol, see other implementations
 
71
 *      }
 
72
 *  };
 
73
 *\endcode
 
74
 *
 
75
 *  \sa \ref SmbLocation, \ref SmbItemInfo, \ref SmbLocationDirIterator, \ref SmbLocationItemFile, \ref SmbLocationItemDir,
 
76
 *      \ref SmbLocationAuthentication , \ref NetAuthenticationData and \ref NetAuthenticationDataList
 
77
 */
 
78
 
 
79
class NetworkLocation: public Location
 
80
{
 
81
protected:
 
82
    explicit NetworkLocation(int type, QObject *parent=0);
 
83
public:
 
84
     virtual DirListWorker * newListWorker(const QString &urlPath,
 
85
                                          QDir::Filters filter,
 
86
                                          const bool isRecursive);
 
87
};
 
88
 
 
89
#endif // NETWORKLOCATION_H