~ubuntu-branches/ubuntu/quantal/kdevplatform/quantal-proposed

« back to all changes in this revision

Viewing changes to project/abstractfilemanagerplugin.h

  • Committer: Bazaar Package Importer
  • Author(s): Bhargav Mangipudi
  • Date: 2010-12-16 19:31:23 UTC
  • mfrom: (0.3.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20101216193123-xe2keh5754zwsn1t
Tags: 1.1.80-0ubuntu1
* New upstream release
  - kdevplatform2-libs is now kdevplatform3-libs due to ABI changes
  - Update kdevplatform3-libs.install to include l10n files
  - Update kdevplatform-dev.install
* Removed localization packages

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   This file is part of KDevelop                                         *
 
3
 *   Copyright 2010 Milian Wolff <mail@milianw.de>                         *
 
4
 *                                                                         *
 
5
 *   This program is free software; you can redistribute it and/or modify  *
 
6
 *   it under the terms of the GNU Library General Public License as       *
 
7
 *   published by the Free Software Foundation; either version 2 of the    *
 
8
 *   License, or (at your option) any later version.                       *
 
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 General Public License for more details.                          *
 
14
 *                                                                         *
 
15
 *   You should have received a copy of the GNU Library General Public     *
 
16
 *   License along with this program; if not, write to the                 *
 
17
 *   Free Software Foundation, Inc.,                                       *
 
18
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
 
19
 ***************************************************************************/
 
20
 
 
21
#ifndef ABSTRACTGENERICMANAGER_H
 
22
#define ABSTRACTGENERICMANAGER_H
 
23
 
 
24
#include "projectexport.h"
 
25
 
 
26
#include "interfaces/iprojectfilemanager.h"
 
27
 
 
28
#include <interfaces/iplugin.h>
 
29
 
 
30
class KDirWatch;
 
31
 
 
32
namespace KDevelop {
 
33
 
 
34
class FileManagerListJob;
 
35
 
 
36
/**
 
37
 * This class can be used as a common base for file managers.
 
38
 *
 
39
 * It supports remote files using KIO and uses KDirWatch to synchronize with on-disk changes.
 
40
 */
 
41
class KDEVPLATFORMPROJECT_EXPORT AbstractFileManagerPlugin : public IPlugin, public virtual IProjectFileManager
 
42
{
 
43
    Q_OBJECT
 
44
    Q_INTERFACES( KDevelop::IProjectFileManager )
 
45
 
 
46
public:
 
47
    explicit AbstractFileManagerPlugin( const KComponentData& instance, QObject *parent = 0,
 
48
                                        const QVariantList &args = QVariantList() );
 
49
    virtual ~AbstractFileManagerPlugin();
 
50
 
 
51
//
 
52
// IProjectFileManager interface
 
53
//
 
54
    virtual Features features() const;
 
55
 
 
56
    virtual ProjectFolderItem* addFolder( const KUrl& folder, ProjectFolderItem *parent );
 
57
    virtual ProjectFileItem* addFile( const KUrl& file, ProjectFolderItem *parent );
 
58
    virtual bool removeFilesAndFolders( QList<ProjectBaseItem*> items);
 
59
    virtual bool renameFolder( ProjectFolderItem *folder, const KUrl& url );
 
60
    virtual bool renameFile( ProjectFileItem *file, const KUrl& url );
 
61
 
 
62
    virtual QList<ProjectFolderItem*> parse( ProjectFolderItem *item );
 
63
    virtual ProjectFolderItem *import( IProject *project );
 
64
    virtual bool reload(ProjectFolderItem* item);
 
65
    virtual KJob* createImportJob(ProjectFolderItem* item);
 
66
 
 
67
protected:
 
68
//
 
69
// AbstractFileManagerPlugin interface
 
70
//
 
71
    /**
 
72
     * Filter interface making it possible to hide files and folders from a project.
 
73
     *
 
74
     * The default implementation will show all files.
 
75
     *
 
76
     * @return True when @p url should belong to @p project, false otherwise.
 
77
     */
 
78
    virtual bool isValid(const KUrl& url, const bool isFolder, IProject* project) const;
 
79
 
 
80
    /**
 
81
     * Customization hook enabling you to create custom FolderItems if required.
 
82
     *
 
83
     * The default implementation will return a simple @c ProjectFolderItem
 
84
     */
 
85
    virtual ProjectFolderItem* createFolderItem( KDevelop::IProject* project, const KUrl& url,
 
86
                                                 KDevelop::ProjectBaseItem* parent = 0);
 
87
 
 
88
    /**
 
89
     * Customization hook enabling you to create custom FileItems if required.
 
90
     *
 
91
     * The default implementation will return a simple @c ProjectFileItem
 
92
     */
 
93
    virtual ProjectFileItem* createFileItem( KDevelop::IProject* project, const KUrl& url,
 
94
                                             KDevelop::ProjectBaseItem* parent);
 
95
 
 
96
    /**
 
97
     * @return the @c KDirWatch for the given @p project.
 
98
     */
 
99
    KDirWatch* projectWatcher( KDevelop::IProject* project ) const;
 
100
 
 
101
Q_SIGNALS:
 
102
    void folderAdded(KDevelop::ProjectFolderItem* folder);
 
103
    void folderRemoved(KDevelop::ProjectFolderItem* folder);
 
104
    void folderRenamed(const KUrl& oldFolder, KDevelop::ProjectFolderItem* newFolder);
 
105
 
 
106
    void fileAdded(KDevelop::ProjectFileItem* file);
 
107
    void fileRemoved(KDevelop::ProjectFileItem* file);
 
108
    void fileRenamed(const KUrl& oldFile, KDevelop::ProjectFileItem* newFile);
 
109
 
 
110
private:
 
111
    struct Private;
 
112
//     friend class Private;
 
113
    Private* const d;
 
114
 
 
115
    Q_PRIVATE_SLOT(d, KJob* eventuallyReadFolder( ProjectFolderItem* item,
 
116
                                                  const bool forceRecursion = false ))
 
117
    Q_PRIVATE_SLOT(d, void addJobItems(FileManagerListJob* job,
 
118
                                       ProjectFolderItem* baseItem,
 
119
                                       const KIO::UDSEntryList& entries,
 
120
                                       const bool forceRecursion))
 
121
 
 
122
    Q_PRIVATE_SLOT(d, void deleted(const QString &path))
 
123
    Q_PRIVATE_SLOT(d, void created(const QString &path))
 
124
 
 
125
    Q_PRIVATE_SLOT(d, void projectClosing(KDevelop::IProject* project))
 
126
    Q_PRIVATE_SLOT(d, void jobFinished(KJob* job))
 
127
};
 
128
 
 
129
}
 
130
 
 
131
#endif // ABSTRACTGENERICMANAGER_H