/usr/include/libqinfinity/browsermodel.h is in libqinfinity-dev 1:0.5.2-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | /*
* Copyright 2009 Gregory Haynes <greg@greghaynes.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QINFINITY_BROWSER_MODEL_H
#define QINFINITY_BROWSER_MODEL_H
#include "communicationmanager.h"
#include <QString>
#include <QList>
#include <QStandardItemModel>
#include <QHash>
#include <QPointer>
namespace QInfinity
{
class ConnectionItem;
class XmlConnection;
class BrowserItemFactory;
class NodeItem;
class Browser;
class BrowserIter;
class NotePlugin;
class ConnectionIndex;
class BrowserModelPrivate;
/**
* @brief A model representing connections and their available files
*
* The BrowserModel provides a model containing connections
* added with BrowserModel::addConnection. Add the plugins
* you wish to use with BrowserModel::addPlugin to allow
* them to be added each connections' Browser. You must also
* call BrowserModel::itemActivated on a directory for it to
* become populated. This is usually done by connecting
* signals from a view to the BrowserModel::itemActivated.
*/
class BrowserModel
: public QStandardItemModel
{
Q_OBJECT;
public:
/**
* @brief Create a new BrowserModel
*/
BrowserModel( QObject *parent = 0 );
/**
* @brief Create BrowserModel with specified BrowserItemFactory
*/
BrowserModel( BrowserItemFactory *itemFactory,
QObject *parent = 0 );
/**
* @brief Destroy the BrowserModel
*/
~BrowserModel();
/**
* @brief Use factory for creating items.
*
* If factory is NULL then BrowserItemFactory is used.
* factory will be reparented.
*/
void setItemFactory( BrowserItemFactory *factory );
/**
* @brief Get factory used by this model.
*/
BrowserItemFactory &itemFactory() const;
/**
* @brief Add connection with name for model to represent.
* @return ConnectionItem representing connection.
*
* The connection will be reparented to the BrowserModel.
* You can remove the connection by removing the appropriate
* row from the model.
*/
ConnectionItem *addConnection( XmlConnection* connection,
const QString &name );
bool hasChildren( const QModelIndex &parent = QModelIndex() ) const;
/**
* @brief Add a plugin to connections in this model.
*
* The plugin will be reparented.
*/
void addPlugin( NotePlugin &plugin );
/**
* @brief Get added plugins.
*/
QList<NotePlugin*> plugins() const;
/**
* @brief Get the current browsers
*/
QList<Browser*> browsers() const;
/**
* @brief Create a directory on the server.
*/
bool createDirectory( const QModelIndex &parent,
const QString &name );
/**
* @brief Create a note of type plugin on the server.
*/
bool createNote( const QModelIndex &parent,
NotePlugin &plugin,
const QString &name );
bool removeRows( int row, int count,
const QModelIndex &parent );
CommunicationManager &communicationManager();
Q_SIGNALS:
void browserAdded( QInfinity::Browser &browser );
void connectionAdded( QInfinity::XmlConnection* connection );
void connectionRemoved( QInfinity::XmlConnection* connection );
public Q_SLOTS:
/**
* @brief Call this when an item has been expanded.
*/
void itemActivated( const QModelIndex &item = QModelIndex() );
private Q_SLOTS:
void slotNodeAdded( const BrowserIter &itr );
void slotNodeRemoved( const BrowserIter &itr );
private:
void removeConnectionItem( ConnectionItem *item );
void deleteNodeItem( NodeItem *item );
void indexIter( const BrowserIter &iter,
Browser &browser,
NodeItem &item );
void removeIterIndex( const BrowserIter &iter,
Browser &browser );
NodeItem *itemFromBrowserIter( const BrowserIter &iter,
Browser &browser );
NodeItem *indexToNodeItem( const QModelIndex &index ) const;
Browser *createBrowser( CommunicationManager &commMgr,
XmlConnection* connection );
BrowserModelPrivate *d_ptr;
Q_DECLARE_PRIVATE(BrowserModel)
};
}
#endif
|