void TalkerChooserConf::slotReEditorButton_clicked() { // Show Regular Expression Editor dialog if it is installed. if ( !m_reEditorInstalled ) return; QDialog *editorDialog = KParts::ComponentFactory::createInstanceFromQuery<QDialog>( "KRegExpEditor/KRegExpEditor" ); if ( editorDialog ) { // kdeutils was installed, so the dialog was found. Fetch the editor interface. KRegExpEditorInterface *reEditor = static_cast<KRegExpEditorInterface *>(editorDialog->qt_cast( "KRegExpEditorInterface" ) ); Q_ASSERT( reEditor ); // This should not fail!// now use the editor. reEditor->setRegExp( m_widget->reLineEdit->text() ); int dlgResult = editorDialog->exec(); if ( dlgResult == QDialog::Accepted ) { QString re = reEditor->regExp(); m_widget->reLineEdit->setText( re ); } delete editorDialog; } else return; }
void Autoreplace_Config::showRegExpEditor() { QDialog *editorDialog = KParts::ComponentFactory::createInstanceFromQuery<QDialog>( "KRegExpEditor/KRegExpEditor" ); if(editorDialog) { // kdeutils was installed, so the dialog was found. Fetch the editor interface. KRegExpEditorInterface *reEditor = static_cast<KRegExpEditorInterface *>(editorDialog->qt_cast( "KRegExpEditorInterface" ) ); Q_ASSERT(reEditor); // This should not fail! reEditor->setRegExp(patternInput->text()); int dlgResult = editorDialog->exec(); if(dlgResult == QDialog::Accepted) { QString re = reEditor->regExp(); patternInput->setText(re); } delete editorDialog; } }