File: CDataSourceNamesFileModel.h

package info (click to toggle)
unixodbc 2.2.14p2-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 14,628 kB
  • ctags: 12,533
  • sloc: ansic: 104,243; cpp: 38,571; sh: 15,958; makefile: 2,727; sql: 1
file content (64 lines) | stat: -rw-r--r-- 1,813 bytes parent folder | download | duplicates (2)
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
/*!
 * \file
 *
 * \author  Peter Harvey <pharvey@peterharvey.org>
 * \author  \sa AUTHORS file
 * \version 2
 * \date    2007
 * \license Copyright unixODBC Project 2007-2008, LGPL
 */
#ifndef CDATASOURCENAMESFILEMODEL_H
#define CDATASOURCENAMESFILEMODEL_H

#include "CODBCInst.h"

#include <QDirModel>

/*! 
 * \class   CDataSourceNamesFileModel
 *
 * \brief   Presents file-based Data Source Names.
 *
 *          This model can be used to display file-based Data Source Names in a given
 *          directory.
 *
 *          This model extends QDirModel by;
 *
 *          \li using default filter (*.dsn)
 *          \li other, more appropriate, defaults (QDir::Files, QDir::Name)
 *          \li methods to; add, edit, and delete a file-based Data Source Name
 *
 *          The usefullness of this being a model instead of being a widget (QListView
 *          derived perhaps) or some other implementation is debatable. But this is a
 *          nice experiment with using a model in this special way - if nothing else.
 *
 * \code
{
    pDataSourceNamesFileModel   = new CDataSourceNamesFileModel;
    pListView                   = new QListView;

    pListView->setViewMode( QListView::IconMode );
    pListView->setModel( pDataSourceNamesFileModel );
    pListView->setRootIndex( pDataSourceNamesFileModel->index( stringDirectory ) );

    playout->addWidget( pListView, 1, 0 );
}
 * \endcode
 *
 * \sa
 */
class CDataSourceNamesFileModel : public QDirModel
{
    Q_OBJECT
public:
    CDataSourceNamesFileModel( QObject* pobjectParent = NULL );
    virtual ~CDataSourceNamesFileModel();

public slots:
    bool addDataSourceName( const QString &stringDirectory );
    bool editDataSourceName( const QModelIndex &modelindex );
    bool deleteDataSourceName( const QModelIndex &modelindex );
};

#endif