KexiDBConnectionWidget::KexiDBConnectionWidget(QWidget* parent)
        : QWidget(parent)
        , d(new Private())
{
    setupUi(this);
    setObjectName("KexiConnSelectorWidget");
    iconLabel->setPixmap(DesktopIcon(KEXI_ICON_DATABASE_SERVER));

    QVBoxLayout *driversComboLyr = new QVBoxLayout(frmEngine);
    m_driversCombo = new KexiDBDriverComboBox(frmEngine, Kexi::driverManager().driversInfo(),
            KexiDBDriverComboBox::ShowServerDrivers);
    //lblEngine->setFocusProxy( m_driversCombo );
    driversComboLyr->addWidget(m_driversCombo);
    frmEngine->setFocusProxy(m_driversCombo);
    lblEngine->setBuddy(m_driversCombo);
    QWidget::setTabOrder(lblEngine, m_driversCombo);

#ifdef NO_LOAD_DB_LIST
    btnLoadDBList->hide();
#endif
    btnLoadDBList->setIcon(KIcon("view-refresh"));
    btnLoadDBList->setToolTip(i18n("Load database list from the server"));
    btnLoadDBList->setWhatsThis(
        i18n("Loads database list from the server, so you can select one using the \"Name\" combo box."));

    QHBoxLayout *hbox = new QHBoxLayout(frmBottom);
    hbox->addStretch(2);
    d->btnSaveChanges = new KPushButton(
        KGuiItem(
            i18n("Save Changes"), "document-save",
            i18n("Save all changes made to this connection information"),
            i18n("Save all changes made to this connection information. "
                 "You can later reuse this information.")),
        frmBottom);
    d->btnSaveChanges->setObjectName("savechanges");
    hbox->addWidget(d->btnSaveChanges);
    hbox->addSpacing(KDialog::spacingHint());
    QWidget::setTabOrder(titleEdit, d->btnSaveChanges);
    d->btnSaveChanges->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

    d->btnTestConnection = new KPushButton(
// @todo add Test Connection icon
        KGuiItem(i18n("&Test Connection"), QString(),
                 i18n("Test database connection"),
                 i18n("Tests database connection. "
                      "You can ensure that valid connection information is provided.")),
        frmBottom);
    d->btnTestConnection->setObjectName("testConnection");
    hbox->addWidget(d->btnTestConnection);
    setTabOrder(d->btnSaveChanges, d->btnTestConnection);
    d->btnTestConnection->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

    connect(locationBGrp, SIGNAL(clicked(int)), this, SLOT(slotLocationBGrpClicked(int)));
    connect(chkPortDefault, SIGNAL(toggled(bool)), this , SLOT(slotCBToggled(bool)));
    connect(btnLoadDBList, SIGNAL(clicked()), this, SIGNAL(loadDBList()));
    connect(d->btnSaveChanges, SIGNAL(clicked()), this, SIGNAL(saveChanges()));
}
Exemplo n.º 2
0
KexiDBConnectionWidget::KexiDBConnectionWidget( QWidget* parent,  const char* name )
 : KexiDBConnectionWidgetBase( parent, name )
 , d(new Private())
{
	iconLabel->setPixmap(DesktopIcon("network"));

	QVBoxLayout *driversComboLyr = new QVBoxLayout(frmEngine);
	m_driversCombo = new KexiDBDriverComboBox(frmEngine, Kexi::driverManager().driversInfo(), 
		KexiDBDriverComboBox::ShowServerDrivers);
	lblEngine->setBuddy( m_driversCombo );
	lblEngine->setFocusProxy( m_driversCombo );
	driversComboLyr->addWidget( m_driversCombo );

#ifdef NO_LOAD_DB_LIST
	btnLoadDBList->hide();
#endif
	btnLoadDBList->setIconSet(SmallIconSet("reload"));
	QToolTip::add(btnLoadDBList, i18n("Load database list from the server"));
	QWhatsThis::add(btnLoadDBList, 
		i18n("Loads database list from the server, so you can select one using the \"Name\" combo box."));

	QHBoxLayout *hbox = new QHBoxLayout(frmBottom);
	hbox->addStretch(2);
	d->btnSaveChanges = new KPushButton(KGuiItem(i18n("Save Changes"), "filesave", 
		i18n("Save all changes made to this connection information"),
		i18n("Save all changes made to this connection information. You can later reuse this information.")), 
		frmBottom, "savechanges");
	hbox->addWidget( d->btnSaveChanges );
	hbox->addSpacing( KDialogBase::spacingHint() );
	QWidget::setTabOrder(titleEdit, d->btnSaveChanges);
	d->btnSaveChanges->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );

	d->btnTestConnection = new KPushButton(KGuiItem(i18n("&Test Connection"), "", 
		i18n("Test database connection"), 
		i18n("Tests database connection. You can ensure that valid connection information is provided.")), 
		frmBottom, "testConnection");
	hbox->addWidget( d->btnTestConnection );
	QWidget::setTabOrder(d->btnSaveChanges, d->btnTestConnection);
	d->btnTestConnection->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );

	connect( locationBGrp, SIGNAL(clicked(int)), this, SLOT(slotLocationBGrpClicked(int)) );
	connect( chkPortDefault, SIGNAL(toggled(bool)), this , SLOT(slotCBToggled(bool)) );
	connect( btnLoadDBList, SIGNAL(clicked()), this, SIGNAL(loadDBList()) );
	connect( d->btnSaveChanges, SIGNAL(clicked()), this, SIGNAL(saveChanges()) );
}