void AdminDatabase::queryButtonClicked()
{
	if ( ! m_listView->currentItem() )
		return;
	
	QVBox *widget = new QVBox(this);

	KTrader::OfferList offers = KTrader::self()->query("text/plain", "'KParts/ReadOnlyPart' in ServiceTypes");
	
	KLibFactory *factory = 0;

	KTrader::OfferList::Iterator it(offers.begin());
	for( ; it != offers.end(); ++it)
	{
		KService::Ptr ptr = (*it);
		factory = KLibLoader::self()->factory( ptr->library() );
		if (factory)
		{
			m_part = static_cast<KParts::ReadOnlyPart *>(factory->create(widget, ptr->name(), "KParts::ReadOnlyPart"));
			m_part->openURL("file://"+m_dumpDir->absPath()+"/"+m_listView->getText(0)+".sql");
			break;
		}
	}
	
	if (!factory)
	{
		KMessageBox::error(this, i18n("Could not find a suitable  component"));
		return;
	}
	
	emit sendWidget(widget,i18n("View dump")); 
}
示例#2
0
void Authorization::init_ui()
{
    ui = new Ui::Authorization;
    ui->setupUi(_set, isSet, this);

    QObject::connect (ui->input, &QLineEdit::textChanged, [&] {
        ui->input->setPalette(ui->p);
    });
    QObject::connect (ui->input, &QLineEdit::returnPressed, [&] {
        if (_set)
            set((ui->input->selectAll(), ui->input->selectedText()));
        else
            match((ui->input->selectAll(), ui->input->selectedText()));

        ui->input->deselect();
    });
    connect (ui->b_reset, SIGNAL(clicked()), this, SLOT(reset()));

    if (!_set)
        emit sendWidget(this);
}