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

Class Index

khexedit'CTabBar (./kdeutils/khexedit/hexmanagerwidget.h:74)

class CTabBar : public QTabBar
{
  Q_OBJECT

  public:
    CTabBar( QWidget *parent=0, char *name=0 );
    void addName( const QString &name );
    void removeName( const QString &name );
    void changeName( const QString &curName, const QString &newName );
    int  count( void );

  protected slots:
    void slotSelected( int id );

  private:
    QTab *find( const QString &name );

  private:
    QValueList<CFileKey> mFileList;

  signals:
    void selected( const QString &filename );
};



khexedit'CTabBar::CTabBar() (./kdeutils/khexedit/hexmanagerwidget.cc:209)

CTabBar::CTabBar( QWidget *parent, char *name )
  :QTabBar( parent, name )
{
  connect( this, SIGNAL(selected(int)), this, SLOT(slotSelected(int)) );
}



khexedit'CTabBar::addName() (./kdeutils/khexedit/hexmanagerwidget.cc:216)

void CTabBar::addName( const QString &name )
{
  QString n( name.right(name.length()-name.findRev('/')-1) );

  QTab *t = find( n );
  if( t == 0 )
  {
    t = new QTab();
    t->label = n;
    int id = addTab( t );
    mFileList.append( CFileKey(name,id) );
  }
  setCurrentTab(t);
}



khexedit'CTabBar::removeName() (./kdeutils/khexedit/hexmanagerwidget.cc:232)

void CTabBar::removeName( const QString &name )
{
  QString n( name.right(name.length()-name.findRev('/')-1) );
  QTab *t = find(n);
  if( t == 0 )
  {
    return;
  }

  QValueList<CFileKey>::Iterator it;
  for( it = mFileList.begin(); it != mFileList.end(); ++it )
  {
    if( (*it).id() == t->id )
    {
      mFileList.remove(it);
      removeTab(t); 
      layoutTabs();
      break;
    }
  }
}



khexedit'CTabBar::changeName() (./kdeutils/khexedit/hexmanagerwidget.cc:255)

void CTabBar::changeName( const QString &curName, const QString &newName )
{
  QString n( curName.right(curName.length()-curName.findRev('/')-1) );
  QTab *t = find(n);
  if( t == 0 )
  {
    return;
  }

  QValueList<CFileKey>::Iterator it;
  for( it = mFileList.begin(); it != mFileList.end(); ++it )
  {
    if( (*it).id() == t->id )
    {
      QString m( newName.right(newName.length()-newName.findRev('/')-1) );
      t->label = m;

      mFileList.remove(it);
      mFileList.append( CFileKey(newName,t->id) );
      layoutTabs();
      update(); // Seems to be necessary
      break;
    }
  }
}



khexedit'CTabBar::find() (./kdeutils/khexedit/hexmanagerwidget.cc:282)

QTab *CTabBar::find( const QString &name )
{
  QList<QTab> &list = *tabList();
  for( QTab *t = list.first(); t != 0; t = list.next() )
  {
    if( t->label == name )
    {
      return( t );
    }
  }

  return( 0 );
}



khexedit'CTabBar::count() (./kdeutils/khexedit/hexmanagerwidget.cc:297)

int CTabBar::count( void )
{
  return( tabList()->count() );
}



khexedit'CTabBar::slotSelected() (./kdeutils/khexedit/hexmanagerwidget.cc:303)

void CTabBar::slotSelected( int id )
{
  QValueList<CFileKey>::Iterator it;
  for( it = mFileList.begin(); it != mFileList.end(); ++it )
  {
    if( (*it).id() == id )
    {
      emit selected( (*it).filename() );
    }
  }
}