Source Code (Use browser search to find items of interest.)
Class Index
khexedit'CFindDialog (./kdeutils/khexedit/dialog.h:90)
class CFindDialog : public KDialogBase
{
Q_OBJECT
public:
enum EOperation
{
find_Again = 0,
find_Next,
find_Previous
};
public:
CFindDialog( QWidget *parent=0, const char *name=0, bool modal=false );
~CFindDialog( void );
bool isEmpty( void );
public slots:
void findAgain( EOperation operation );
protected:
virtual void showEvent( QShowEvent *e );
private slots:
void slotOk( void );
void selectorChanged( int index );
void inputChanged( const QString &text );
signals:
void findData( SSearchControl &sc, uint mode, bool navigator );
private:
QComboBox *mSelector;
QLineEdit *mInput;
QCheckBox *mCheckBackward;
QCheckBox *mCheckFromCursor;
QCheckBox *mCheckInSelection;
QCheckBox *mCheckUseNavigator;
QCheckBox *mCheckIgnoreCase;
QString mFindString[4];
QByteArray mFindData;
CHexValidator *mFindValidator;
};
khexedit'CFindDialog::CFindDialog() (./kdeutils/khexedit/dialog.cc:173)
CFindDialog::CFindDialog( QWidget *parent, const char *name, bool modal )
:KDialogBase( Plain, i18n("Find"), Ok|Cancel, Ok, parent, name, modal )
{
QVBoxLayout *topLayout = new QVBoxLayout( plainPage(), 0, spacingHint() );
if( topLayout == 0 ) { return; }
QVBoxLayout *vbox = new QVBoxLayout();
if( vbox == 0 ) { return; }
topLayout->addLayout( vbox );
mSelector = new QComboBox( false, plainPage() );
if( mSelector == 0 ) { return; }
mSelector->setMinimumWidth( fontMetrics().maxWidth()*17 );
mSelector->insertStringList( formatStrings() );
connect( mSelector, SIGNAL(activated(int)), SLOT(selectorChanged(int)) );
QLabel *label = new QLabel( mSelector, i18n("Fo&rmat"), plainPage() );
if( label == 0 ) { return; }
vbox->addWidget( label );
vbox->addWidget( mSelector );
mInput = new QLineEdit( plainPage() );
if( mInput == 0 ) { return; }
mInput->setMinimumWidth( fontMetrics().maxWidth()*17 );
connect( mInput, SIGNAL(textChanged(const QString&)),
SLOT(inputChanged(const QString&)) );
mFindValidator = new CHexValidator( this, CHexValidator::regularText );
if( mFindValidator == 0 ) { return; }
mInput->setValidator( mFindValidator );
label = new QLabel( mInput, i18n("F&ind"), plainPage() );
if( label == 0 ) { return; }
vbox->addWidget( label );
vbox->addWidget( mInput );
QButtonGroup *group = new QButtonGroup( i18n("Options"), plainPage() );
if( group == 0 ) { return; }
topLayout->addWidget( group, 10 );
QGridLayout *gbox = new QGridLayout( group, 5, 2, spacingHint() );
if( gbox == 0 ) { return; }
gbox->addRowSpacing( 0, fontMetrics().lineSpacing() );
mCheckFromCursor = new QCheckBox( i18n("&From cursor"), group );
gbox->addWidget( mCheckFromCursor, 1, 0 );
mCheckBackward = new QCheckBox( i18n("&Backwards"), group );
gbox->addWidget( mCheckBackward, 1, 1 );
mCheckInSelection = new QCheckBox( i18n("&In selection"), group );
gbox->addWidget( mCheckInSelection, 2, 0 );
mCheckUseNavigator = new QCheckBox( i18n("&Use navigator"),group);
gbox->addWidget( mCheckUseNavigator, 2, 1 );
mCheckIgnoreCase = new QCheckBox( i18n("Ignore c&ase"),group);
gbox->addWidget( mCheckIgnoreCase, 3, 0 );
gbox->setRowStretch( 4, 10 );
mCheckFromCursor->setChecked( true );
mCheckUseNavigator->setChecked( true );
}
khexedit'CFindDialog::~CFindDialog() (./kdeutils/khexedit/dialog.cc:236)
CFindDialog::~CFindDialog( void )
{
delete mFindValidator;
}
khexedit'CFindDialog::selectorChanged() (./kdeutils/khexedit/dialog.cc:242)
void CFindDialog::selectorChanged( int index )
{
mFindValidator->setState( (CHexValidator::EState)index );
mInput->setText( mFindString[ index ] );
mCheckIgnoreCase->setEnabled( index == 0 ? true : false );
}
khexedit'CFindDialog::inputChanged() (./kdeutils/khexedit/dialog.cc:250)
void CFindDialog::inputChanged( const QString &text )
{
mFindString[ mSelector->currentItem() ] = text;
mFindValidator->convert( mFindData,
mFindString[ mSelector->currentItem() ] );
}
khexedit'CFindDialog::showEvent() (./kdeutils/khexedit/dialog.cc:258)
void CFindDialog::showEvent( QShowEvent *e )
{
KDialogBase::showEvent(e);
mInput->setFocus();
}
khexedit'CFindDialog::isEmpty() (./kdeutils/khexedit/dialog.cc:265)
bool CFindDialog::isEmpty( void )
{
return( mFindData.isEmpty() );
}
khexedit'CFindDialog::slotOk() (./kdeutils/khexedit/dialog.cc:271)
void CFindDialog::slotOk( void )
{
if( isEmpty() == true )
{
showEntryFailure( this, QString("") );
return;
}
SSearchControl sc;
sc.key = mFindData;
sc.keyType = mSelector->currentItem();
sc.fromCursor = mCheckFromCursor->isChecked();
sc.inSelection = mCheckInSelection->isChecked();
sc.forward = mCheckBackward->isChecked() == true ? false : true;
if( mCheckBackward->isEnabled() == true )
{
sc.ignoreCase = mCheckIgnoreCase->isChecked();
}
else
{
sc.ignoreCase = false;
}
hide();
emit findData( sc, Find_First, mCheckUseNavigator->isChecked() );
}
khexedit'CFindDialog::findAgain() (./kdeutils/khexedit/dialog.cc:299)
void CFindDialog::findAgain( EOperation operation )
{
if( isEmpty() == true )
{
showEntryFailure( this, QString("") );
return;
}
SSearchControl sc;
sc.key = mFindData;
sc.fromCursor = true;
sc.inSelection = mCheckInSelection->isChecked();
if( operation == find_Next )
{
sc.forward = true;
}
else if( operation == find_Previous )
{
sc.forward = false;
}
else
{
sc.forward = mCheckBackward->isChecked() == true ? false : true;
}
hide();
emit findData( sc, Find_Next, false );
}