File: CDataSourceNames.cpp

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 (78 lines) | stat: -rw-r--r-- 2,684 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*!
 * \file
 *
 * \author  Peter Harvey <pharvey@peterharvey.org>
 * \author  \sa AUTHORS file
 * \version 2
 * \date    2007
 * \license Copyright unixODBC Project 2007-2008, LGPL
 */
#include <QtGui>

#include "CDataSourceNames.h"

#include "CDataSourceNameList.h"

#include "DataSourceNameUser48.xpm"
#include "DataSourceNameSystem48.xpm"

CDataSourceNames::CDataSourceNames( QWidget* pwidgetParent, int nSource )
    : QWidget( pwidgetParent )
{
    Q_ASSERT( (nSource == ODBC_USER_DSN || nSource == ODBC_SYSTEM_DSN) );

    this->nSource = nSource;

    pDataSourceNameList = new CDataSourceNameList( this, nSource );

    QPushButton *ppushbuttonAdd = new QPushButton( tr( "A&dd..." ) );
    ppushbuttonAdd->setToolTip( tr( "click to add a data source name" ) );
    ppushbuttonAdd->setWhatsThis( tr( "Click this to add a data source name. A registered driver is selected then an attempt is made to load the drivers setup code. The drivers setup should support the unixODBC setup feature." ) );

    QPushButton *ppushbuttonConfigure = new QPushButton( tr( "&Configure..." ) );
    ppushbuttonConfigure->setToolTip( tr( "click to configure the selected data source name" ) );
    ppushbuttonConfigure->setWhatsThis( tr( "Click to edit the data source name properties." ) );

    QPushButton *ppushbuttonRemove = new QPushButton( tr( "&Remove" ) );
    ppushbuttonRemove->setToolTip( tr( "click to remove the selected data source name" ) );
    ppushbuttonRemove->setWhatsThis( tr( "Click to remove the select data source name." ) );

    QHBoxLayout *playout                = new QHBoxLayout;
    QVBoxLayout *playoutButtons         = new QVBoxLayout;

    playoutButtons->addWidget( ppushbuttonAdd );
    playoutButtons->addWidget( ppushbuttonConfigure );
    playoutButtons->addWidget( ppushbuttonRemove );
    playoutButtons->addStretch( 10 );

    playout->addWidget( pDataSourceNameList );
    playout->addLayout( playoutButtons );

    setLayout( playout );

    connect( ppushbuttonAdd, SIGNAL(clicked()), pDataSourceNameList, SLOT(slotAdd()) );
    connect( ppushbuttonConfigure, SIGNAL(clicked()), pDataSourceNameList, SLOT(slotEdit()) );
    connect( ppushbuttonRemove, SIGNAL(clicked()), pDataSourceNameList, SLOT(slotDelete()) );

    if ( nSource == ODBC_USER_DSN )
    {
        setWindowIcon( QPixmap( xpmDataSourceNameUser48 ) );
        setWindowTitle( tr( "User Data Source Names" ) );
    }
    else
    {
        setWindowIcon( QPixmap( xpmDataSourceNameSystem48 ) );
        setWindowTitle( tr( "System Data Source Names" ) );
    }
}

CDataSourceNames::~CDataSourceNames()
{
}

void CDataSourceNames::slotLoad()
{
    pDataSourceNameList->slotLoad();
}