Source Code (Use browser search to find items of interest.)

Class Index

khexedit'CFindNavigatorDialog (./kdeutils/khexedit/dialog.h:137)

class CFindNavigatorDialog : public KDialogBase
{
  Q_OBJECT
  
  public:
    CFindNavigatorDialog( QWidget *parent=0, const char *name=0, 
			  bool modal=false );
    ~CFindNavigatorDialog( void );
    void defineData( SSearchControl &sc );

  private slots:
    void slotUser1( void );
    void slotUser2( void );
    void slotUser3( void );
    void slotClose( void );

  private:
    void done( int returnCode );

  signals:
    void findData( SSearchControl &sc, uint mode, bool navigator );
    void makeKey( void );

  private:
    QLineEdit *mKey;
    SSearchControl mSearchControl;
};



khexedit'CFindNavigatorDialog::CFindNavigatorDialog() (./kdeutils/khexedit/dialog.cc:330)

CFindNavigatorDialog::CFindNavigatorDialog( QWidget *parent, const char *name,
					     bool modal )
  :KDialogBase( Plain, i18n("Find (Navigator)"), User3|User2|User1|Close, 
		User2, parent, name, modal, true, i18n("New &key"), 
		i18n("&Next"), i18n("&Previous") )
{
  QString text;
  QBoxLayout *topLayout = new QVBoxLayout( plainPage(), 0, spacingHint() );
  if( topLayout == 0 ) { return; }

  topLayout->addSpacing( spacingHint() ); // A little bit extra space

  QHBoxLayout *hbox = new QHBoxLayout();
  if( hbox == 0 ) { return; }
  topLayout->addLayout( hbox );

  text = i18n("Searching for:");
  QLabel *label = new QLabel( text, plainPage() );
  hbox->addWidget( label );
 
  mKey = new QLineEdit( plainPage() );
  mKey->setMinimumWidth( fontMetrics().width("M") * 20 );
  mKey->setFocusPolicy( QWidget::NoFocus );
  hbox->addWidget( mKey );

  topLayout->addSpacing( spacingHint() ); // A little bit extra space
  topLayout->addStretch(10);
}



khexedit'CFindNavigatorDialog::~CFindNavigatorDialog() (./kdeutils/khexedit/dialog.cc:360)

CFindNavigatorDialog::~CFindNavigatorDialog( void )
{
}



khexedit'CFindNavigatorDialog::defineData() (./kdeutils/khexedit/dialog.cc:365)

void CFindNavigatorDialog::defineData( SSearchControl &sc )
{
  mSearchControl = sc;
  mSearchControl.key.duplicate( sc.key );

  if( mSearchControl.key.isEmpty() == true )
  {
    mKey->setText("");
    return;
  }

  if( mSearchControl.keyType == 0 )
  {
    QString str;
    for( uint i=0; i<mSearchControl.key.size(); i++ )
    {
      str += mSearchControl.key[i];
    }
    mKey->setText( str );

  }
  else if( mSearchControl.keyType == 1 )
  {
    QString str("0x ");
    for( uint i=0; i<mSearchControl.key.size(); i++ )
    {
      str += QString().sprintf("%02X ", (unsigned char)mSearchControl.key[i]);
    }
    mKey->setText( str );
  }
  else if( mSearchControl.keyType == 2 )
  {
    QString str;
    for( uint i=0; i<mSearchControl.key.size(); i++ )
    {
      str += QString().sprintf("%03o ", (unsigned char)mSearchControl.key[i]);
    }
    mKey->setText( str );
  }
  else
  {
    char buf[10];
    memset( buf, 0, sizeof( buf ) ); buf[8] = ' ';

    QString str;
    for( uint i=0; i<mSearchControl.key.size(); i++ )
    {
      unsigned char data = (unsigned char)mSearchControl.key[i];
      for( int j = 0; j < 8; j++ )
      {
	buf[7-j] = (data&(1<<j)) ? '1' : '0';
      }
      str += buf;
    }
    mKey->setText( str );
  }
}



khexedit'CFindNavigatorDialog::slotUser3() (./kdeutils/khexedit/dialog.cc:424)

void CFindNavigatorDialog::slotUser3( void ) // Previous 
{
  done( repPrevious );
}



khexedit'CFindNavigatorDialog::slotUser2() (./kdeutils/khexedit/dialog.cc:430)

void CFindNavigatorDialog::slotUser2( void ) // Next 
{
  done( repNext );
}



khexedit'CFindNavigatorDialog::slotUser1() (./kdeutils/khexedit/dialog.cc:436)

void CFindNavigatorDialog::slotUser1( void ) // New key
{
  done( repNewKey );
}



khexedit'CFindNavigatorDialog::slotClose() (./kdeutils/khexedit/dialog.cc:442)

void CFindNavigatorDialog::slotClose( void ) 
{
  done( repClose );
}



khexedit'CFindNavigatorDialog::done() (./kdeutils/khexedit/dialog.cc:448)

void CFindNavigatorDialog::done( int resultCode ) 
{
  setResult( resultCode );
  if( resultCode == repClose || resultCode == repNewKey )
  {
    if( resultCode == repNewKey )
    {
      emit makeKey();
    }
    hide();
    return;
  }

  mSearchControl.forward = resultCode == repNext ? true : false;
  emit findData( mSearchControl, Find_Next, true );
}