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

Class Index

ksysv'KSVDragListCanvas (./kdeadmin/ksysv/DragListCanvas.h:40)

class KSVDragListCanvas : public KDNDWidget {
  Q_OBJECT

public:
  KSVDragListCanvas(QWidget* parent = 0, const char* name = 0);
  virtual ~KSVDragListCanvas();

protected:
  friend class KSVDragList;

  /* overridden */
  virtual void dndMouseMoveEvent ( QMouseEvent* _mouse );
  virtual void dndMouseReleaseEvent ( QMouseEvent* e );
  virtual void dragEndEvent();
  virtual void mousePressEvent ( QMouseEvent* e);
  virtual void mouseReleaseEvent ( QMouseEvent* e );
  virtual void paintEvent ( QPaintEvent* e );
  virtual void resizeEvent ( QResizeEvent* e );
  virtual void keyPressEvent ( QKeyEvent* e );
  virtual void keyReleaseEvent ( QKeyEvent* e );
  virtual void mouseDoubleClickEvent ( QMouseEvent* e );
  virtual void mouseMoveEvent ( QMouseEvent* e );
  virtual void focusInEvent ( QFocusEvent* e );
  virtual void focusOutEvent ( QFocusEvent* e );

  /* new */
  void updateTooltips();
  inline void adjustSize();
  inline void draw();
  inline void draw(const int index);
  void draw(int start, int end);
  void redrawFocus();
  KSVDragData* getObject(int _y, bool* _upper);
  inline KSVDragData* getObject(int _y);
  QPixmap getDefaultIcon();
  inline bool withinLimits( int x, int y ) const;

  int focus;
  bool noFocus;
  int oldFocus;
  bool pressed;
  bool ro;
  int press_x, press_y;
  QTimer* timer;
  QPoint _lastPos;
  KDNDDropZone* dz;
  QPixmap defaultIcon;
  QPixmap selIcon;
  QPixmap multiIcon;
  QBitmap monoIcon;
  QString runlevel;
  QPixmap buffer;
  KSVList list;	
  bool origin;
  QPopupMenu* popup;

 public slots:
  void slotDropEvent( KDNDDropZone* _zone );
  void setDefaultIcon( const char* _icon );
  void setRunlevel( QString _run);
  void insertItem( int _index, KSVDragData* _item, const bool genNr = FALSE );
  void removeItem( KSVDragData* _item );
  void setReadOnly(bool _value);
  void clear();
  void setOrigin(bool val = TRUE);
  void selectItem( int val );
  void setChangedColor( const QColor& color );
  void setNewColor( const QColor& color );

  /**
    * add popup menu for entries
    */
  virtual void addPMenu( QPopupMenu* menu );

protected slots:
  void autoScrollTimer();

signals:
  void sigDropOccured( KDNDDropZone* _zone, KSVDragListCanvas* _w, bool _pos);
  void sigOrigin( bool val );
  void sigDroppedFrom(QString _par, KSVDragData* _w);
  void sigChanged();
  void sigRightPressed(KSVDragListCanvas* _list, KSVDragData* _data, QPoint _pos);
  void sigResize(int _w, int _h);
  void sigScrollDown(int _focus);
  void sigScrollUp(int _focus);
  void sigNotRemovable();
  void sigDoubleClick(KSVDragListCanvas* _list, KSVDragData* _data, QPoint _pos);
  void mouseMove( int _x, int _y );
  void cannotGenerateNumber();

  /**
   * cut & copy only allowed if some entry is selected
   */
  void selected( const KSVDragData* );

public:
  inline virtual int count() const;
  inline virtual int find( const KSVDragData* o ) const;
  const QString getRunlevel() const;
  virtual KSVDragData* at(int _index);
  inline bool isOrigin() const;

  /**
   * May we insert the item here?
   */
  bool insertOK( KSVDragData* _data, const int where );

  int focusItem() const;

  /**
   * interpolate a sorting number using the numbers
   * above and below index.
   * Returns -1 if no number could be generated
   * (i.e. delta(nr(index-1),nr(index+1)) <= 1)
   */
  int generateNumber( const int index );

public slots:
  inline void reSort();
  
  
protected:
  QColor _newColor;
  QColor _changedColor;


private:
  QColor hiCol;
  QColor blackCol;
  QColor whiteCol;
  QColor hiText;
  QColor midCol;
  QColor paint_back;
  QColor paint_text;
  QFont italic;
};

ksysv'KSVDragListCanvas::KSVDragListCanvas() (./kdeadmin/ksysv/DragListCanvas.cpp:41)

KSVDragListCanvas::KSVDragListCanvas(QWidget* parent, const char* name)
: KDNDWidget(parent, name),
  focus(NONE)
{
  dz = new KDNDDropZone(this, DndText);

  // connect the dropZone with my dropAction
  connect(dz, SIGNAL(dropAction(KDNDDropZone* )), this, SLOT(slotDropEvent( KDNDDropZone* )));
  // set background mode
  setBackgroundMode( NoBackground );

  // init (double-) buffer
  buffer = QPixmap(1,1);

  adjustSize();

  // initialize other class members
//   focus = 0;
  noFocus = FALSE;
  oldFocus = -1;
  pressed = FALSE;
  ro = FALSE;
  runlevel = "Foo";
  origin = FALSE;
  popup = 0;
  _newColor = blue;
  _changedColor = red;
  timer = new QTimer(this);
  connect(timer, SIGNAL(timeout()), this, SLOT(autoScrollTimer()));

  // init members needed by draw()
  hiCol = colorGroup().highlight();
  hiText = colorGroup().highlightedText();
  midCol = colorGroup().mid();

  blackCol = colorGroup().text();
  whiteCol = colorGroup().base();

  italic = KGlobal::fixedFont();
  //  italic.setItalic(TRUE);
}


ksysv'KSVDragListCanvas::~KSVDragListCanvas() (./kdeadmin/ksysv/DragListCanvas.cpp:83)

KSVDragListCanvas::~KSVDragListCanvas() {
  // nothing yet
}


ksysv'KSVDragListCanvas::dndMouseMoveEvent() (./kdeadmin/ksysv/DragListCanvas.cpp:87)

void KSVDragListCanvas::dndMouseMoveEvent ( QMouseEvent* _mouse ) {
  // 'pressed' is set in mousePressedEvent(...)
  if ( !pressed )
    return;

  int x = _mouse->pos().x();
  int y = _mouse->pos().y();

  if ( abs( x - press_x ) > Dnd_X_Precision || abs( y - press_y ) > Dnd_Y_Precision ) {

    KSVDragData* localO = getObject(y);
    if (!localO)
      return;

    const QString data = localO->toString();
    QPixmap pixmap = KSVCore::drawDragIcon( defaultIcon, monoIcon, QString::null, localO );

    const QPoint p = mapToGlobal( _mouse->pos() );

    const int dx = - ( monoIcon.width() + 2); // - pixmap.width() / 2;
    const int dy = - ( pixmap.height() / 2 + 2 );

    startDrag( new KDNDIcon( pixmap, p.x() + dx, p.y() + dy ), data.data(), data.length(), DndText, dx, dy );
    pressed = FALSE;
    timer->start(50);
  } else {
    // nothing to do
  }
}


ksysv'KSVDragListCanvas::dndMouseReleaseEvent() (./kdeadmin/ksysv/DragListCanvas.cpp:117)

void KSVDragListCanvas::dndMouseReleaseEvent( QMouseEvent* /* e */ ) {
  pressed = FALSE;
  redrawFocus();
}


ksysv'KSVDragListCanvas::mousePressEvent() (./kdeadmin/ksysv/DragListCanvas.cpp:122)

void KSVDragListCanvas::mousePressEvent( QMouseEvent * _mouse ) {
  // Does the user want to select the icon ?
  if (withinLimits( _mouse->x(), _mouse->y() )) {

    if ( _mouse->button() == LeftButton ) {
      pressed = TRUE;
    } else if ( _mouse->button() == RightButton ) {
      pressed = FALSE;
      setFocus();
      if (popup)
	popup->popup( mapToGlobal(_mouse->pos()) );
    }
  }

  oldFocus = focus;
  focus = list.find(getObject(_mouse->y()));

  redrawFocus();
}


ksysv'KSVDragListCanvas::mouseReleaseEvent() (./kdeadmin/ksysv/DragListCanvas.cpp:142)

void KSVDragListCanvas::mouseReleaseEvent( QMouseEvent* e ) {
  KDNDWidget::mouseReleaseEvent( e );
}


ksysv'KSVDragListCanvas::mouseDoubleClickEvent() (./kdeadmin/ksysv/DragListCanvas.cpp:146)

void KSVDragListCanvas::mouseDoubleClickEvent( QMouseEvent* _mouse ) {
  if (_mouse->button() == LeftButton)
    emit sigDoubleClick( this, getObject(_mouse->y()), QPoint(_mouse->x(), _mouse->y()));
}


ksysv'KSVDragListCanvas::paintEvent() (./kdeadmin/ksysv/DragListCanvas.cpp:151)

void KSVDragListCanvas::paintEvent( QPaintEvent* e ) {
  // just blit the buffer onto the widget...
  const QRect& rect = e->rect();
  bitBlt( this, rect.topLeft(), &buffer, rect );
}


ksysv'KSVDragListCanvas::slotDropEvent() (./kdeadmin/ksysv/DragListCanvas.cpp:157)

void KSVDragListCanvas::slotDropEvent( KDNDDropZone* _zone) {
  if (!ro &&_zone->getAcceptType() == _zone->getDataType() ) {
    const QString droppedData = _zone->getData();

    QPoint akt_pos = mapFromGlobal(QCursor::pos());
    bool upper;
    int position = list.find(getObject(akt_pos.y(), &upper));

    KSVDragData* newO = new KSVDragData();
    newO->fromString(droppedData);

    if (!upper)
      position++;

    if (!insertOK(newO, position)) {
      delete newO;
      return;
    }

    // for removing elsewhere
    const QString _old_rl = newO->runlevel();

    // change sort number
    const int temp = generateNumber(position);
    if (temp == -1) {
      emit cannotGenerateNumber();
      delete newO;
      return;
    } else
      newO->setNumber(temp);

    insertItem(position, newO);

    emit sigDropOccured( _zone, this, upper );
    if (_old_rl != runlevel)
      emit sigDroppedFrom(_old_rl, newO);
  }
}


ksysv'KSVDragListCanvas::setDefaultIcon() (./kdeadmin/ksysv/DragListCanvas.cpp:196)

void KSVDragListCanvas::setDefaultIcon( const char* _icon ) {
  QString icon_name = QString("ksysv_%1.xpm").arg(_icon);
  QString mono_name = QString("mono_%1.xpm").arg(_icon);
  QString multi_name = QString("multi_%1.xpm").arg(_icon);

  defaultIcon = BarIcon( icon_name );
  multiIcon = BarIcon( multi_name );
  monoIcon = BarIcon( mono_name );

  // prepare the icon in "selected" state
  selIcon = defaultIcon;
  QPainter p;
  QBrush b( colorGroup().highlightedText(), Dense4Pattern );
  p.begin(&selIcon);
  p.fillRect( 0, 0, selIcon.width(), selIcon.height(), b );
  p.end();
  selIcon.setMask(monoIcon);

  draw();
}


ksysv'KSVDragListCanvas::getDefaultIcon() (./kdeadmin/ksysv/DragListCanvas.cpp:217)

QPixmap KSVDragListCanvas::getDefaultIcon() {
  return defaultIcon;
}


ksysv'KSVDragListCanvas::resizeEvent() (./kdeadmin/ksysv/DragListCanvas.cpp:221)

void KSVDragListCanvas::resizeEvent( QResizeEvent* e ) {
  const int w = width();
  const int h = height();

  buffer.resize(w,h);
  emit sigResize(w,h);

  const int w_o = e->oldSize().width();
  const int h_o = e->oldSize().height();

  if (w_o < w || h_o < h)
    draw();
}


ksysv'KSVDragListCanvas::getObject() (./kdeadmin/ksysv/DragListCanvas.cpp:235)

KSVDragData* KSVDragListCanvas::getObject( int _y, bool* upperHalf) {
  if (list.isEmpty())
    return 0;

  int res = _y / ENTRY_HEIGHT;

  *upperHalf = (_y % ENTRY_HEIGHT) < ENTRY_HEIGHT / 2 ? TRUE : FALSE;
  res = count() - 1 < res ? res - 1 : res;

  return list.at(res);
}


ksysv'KSVDragListCanvas::getObject() (./kdeadmin/ksysv/DragListCanvas.cpp:247)

KSVDragData* KSVDragListCanvas::getObject(int _y) {
  bool foo;
  return getObject( _y, &foo );
}


ksysv'KSVDragListCanvas::insertItem() (./kdeadmin/ksysv/DragListCanvas.cpp:252)

void KSVDragListCanvas::insertItem(int _index, KSVDragData* _o, const bool genNr) {
  if (runlevel != _o->runlevel()) {
    KSVDragData* _tmp = _o;
    _o = new KSVDragData(*_tmp);

    _o->setNew();
    _o->setChanged(FALSE);
  }

  _o->setRunlevel(runlevel);

  // generate a sorting number if neccessary
  if (genNr) {
    const int result = generateNumber(_index);
    if (result > -1)
      _o->setNumber(result);
    else {
      emit cannotGenerateNumber();
      delete _o;
      return;
    }
  }

  int pos = list.find(_o);
  if (pos == -1) {
    list.insert( (uint)_index, _o);
  } else {
    KSVDragData* tmp_o = list.at(pos);
    list.remove(tmp_o);

    tmp_o->setNumber( _o->number() );

    if (pos < _index)
      _index--;

    list.insert( (uint)_index, tmp_o);

    delete _o;
  }

  adjustSize();
  int start, end;

  if (pos != -1) {
    start = pos < _index ? pos : _index;
    end = start != pos ? pos : _index;
  } else {
    start = _index;
    end = count() - 1;
  }

  draw(start,end);
  updateTooltips();

  if (pos != _index) {// if the item is not inserted into the same position as an existing one
    emit sigChanged();
  }
}


ksysv'KSVDragListCanvas::count() (./kdeadmin/ksysv/DragListCanvas.cpp:311)

int KSVDragListCanvas::count() const {
  return (const int)list.count();
}


ksysv'KSVDragListCanvas::keyPressEvent() (./kdeadmin/ksysv/DragListCanvas.cpp:315)

void KSVDragListCanvas::keyPressEvent( QKeyEvent* e ) {
  const int maxIndex = count() - 1;

  switch( e->key() ) {                    // Look at the key code

  case Key_Up:
    oldFocus = focus;
    if (focus > 0)
      focus--;

    redrawFocus();
    emit sigScrollUp(focus);
    break;

  case Key_Down:
    oldFocus = focus;
    if (focus < maxIndex)
      focus++;

    redrawFocus();
    emit sigScrollDown(focus);
    break;

  case Key_Enter:
    emit sigDoubleClick(this, at(focus), QPoint(1, focus * ENTRY_HEIGHT));
    break;

  case Key_Return:
    emit sigDoubleClick(this, at(focus), QPoint(1, focus * ENTRY_HEIGHT));
    break;

  default:                              // If not an interesting key,
    e->ignore();                        // we don't accept the event
    return;
  }
}


ksysv'KSVDragListCanvas::removeItem() (./kdeadmin/ksysv/DragListCanvas.cpp:352)

void KSVDragListCanvas::removeItem( KSVDragData* _item ) {
  const int i = list.find(_item);
  if (i != -1) {
    list.remove(list.at(i));
    adjustSize();
    draw(i, count());
    updateTooltips();
    if (list.find(_item) != i) { // if it wasn't a drop on itself
      emit sigChanged();
    }
  }

  if (focus)
    {
      if (focus >= count())
	focus--;
    }
  else
    {
      noFocus = true;
      emit selected(0);
    }
}


ksysv'KSVDragListCanvas::clear() (./kdeadmin/ksysv/DragListCanvas.cpp:376)

void KSVDragListCanvas::clear() {
  list.setAutoDelete(TRUE);
  int max = count();

  // I donīt do list.clear because of cpu load

  for(int i = 0; i < max; ++i) {
    // keep GUI alive
    qApp->processEvents();
    list.remove(list.at(0));
  }

  list.setAutoDelete(FALSE);
  adjustSize();
  draw();
  updateTooltips();

  // keep GUI alive
  qApp->processEvents();

  focus=NONE;
}


ksysv'KSVDragListCanvas::setRunlevel() (./kdeadmin/ksysv/DragListCanvas.cpp:399)

void KSVDragListCanvas::setRunlevel( QString _run ) {
  runlevel = _run;
}


ksysv'KSVDragListCanvas::updateTooltips() (./kdeadmin/ksysv/DragListCanvas.cpp:403)

void KSVDragListCanvas::updateTooltips() {
  const int max = count();
  int y = 0;

  // add tooltip
  for (int i = 0; i < max; i++) {
    QToolTip::add(this, QRect(0, y, 80, ENTRY_HEIGHT), list.at(i)->filenameAndPath());
    y += ENTRY_HEIGHT;
  }
}


ksysv'KSVDragListCanvas::adjustSize() (./kdeadmin/ksysv/DragListCanvas.cpp:414)

void KSVDragListCanvas::adjustSize() {
  resize(width(), count() * ENTRY_HEIGHT);
}


ksysv'KSVDragListCanvas::getRunlevel() (./kdeadmin/ksysv/DragListCanvas.cpp:418)

const QString KSVDragListCanvas::getRunlevel() const {
  return runlevel;
}


ksysv'KSVDragListCanvas::setReadOnly() (./kdeadmin/ksysv/DragListCanvas.cpp:422)

void KSVDragListCanvas::setReadOnly(bool _value) {
  ro = _value;
}


ksysv'KSVDragListCanvas::at() (./kdeadmin/ksysv/DragListCanvas.cpp:426)

KSVDragData* KSVDragListCanvas::at(int _index) {
  if (_index < count() && _index > -1)
    return list.at(_index);
  else
    return 0;
}


ksysv'KSVDragListCanvas::mouseMoveEvent() (./kdeadmin/ksysv/DragListCanvas.cpp:433)

void KSVDragListCanvas::mouseMoveEvent( QMouseEvent* e ) {
  _lastPos = mapToGlobal(e->pos());

  KDNDWidget::mouseMoveEvent( e );
}


ksysv'KSVDragListCanvas::dragEndEvent() (./kdeadmin/ksysv/DragListCanvas.cpp:439)

void KSVDragListCanvas::dragEndEvent() {
  timer->stop();

  KDNDWidget::dragEndEvent();
}


ksysv'KSVDragListCanvas::setOrigin() (./kdeadmin/ksysv/DragListCanvas.cpp:445)

void KSVDragListCanvas::setOrigin( bool val ) {
  const bool old_nof = noFocus; // remember noFocus
  noFocus = FALSE;

  const bool oldOrigin = origin;
  origin = val;
  if ( origin && !oldOrigin) {
    redrawFocus();
    emit sigOrigin( FALSE );
  } else if ( oldOrigin && !origin ) {
    redrawFocus();
  } else if (old_nof)
    redrawFocus();

  if (origin)
    emit selected(list.at(focus));
}


ksysv'KSVDragListCanvas::isOrigin() (./kdeadmin/ksysv/DragListCanvas.cpp:463)

bool KSVDragListCanvas::isOrigin() const {
  return origin;
}


ksysv'KSVDragListCanvas::focusInEvent() (./kdeadmin/ksysv/DragListCanvas.cpp:467)

void KSVDragListCanvas::focusInEvent( QFocusEvent* ) {
  if (count() && focus == NONE)
    {	
      focus = 0;
      redrawFocus();
    }

  setOrigin(TRUE);
}


ksysv'KSVDragListCanvas::focusOutEvent() (./kdeadmin/ksysv/DragListCanvas.cpp:477)

void KSVDragListCanvas::focusOutEvent( QFocusEvent* ) {
  redrawFocus();
}


ksysv'KSVDragListCanvas::draw() (./kdeadmin/ksysv/DragListCanvas.cpp:481)

void KSVDragListCanvas::draw() {
  draw(0, count() - 1);
}


ksysv'KSVDragListCanvas::draw() (./kdeadmin/ksysv/DragListCanvas.cpp:485)

void KSVDragListCanvas::draw( const int index ) {
  draw(index,index);
}


ksysv'KSVDragListCanvas::draw() (./kdeadmin/ksysv/DragListCanvas.cpp:489)

void KSVDragListCanvas::draw( int start, int end ) {
  // available fonts && colors
  /*
    QColor hiCol;
    QColor blackCol;
    QColor whiteCol;
    QColor hiText;
    QColor midCol;
    QColor paint_back;
    QColor paint_text;
    QFont italic;
  */

  const int list_count = count();

  end = end < list_count ? end : list_count - 1;

  if (start < 0) warning("start < 0");

  // trying to optimize a bit more
  // is "register" ok?
  register int paint_y = ENTRY_HEIGHT * start;
  register int paint_width = width() + 1;
  register int paint_height = ENTRY_HEIGHT;

  QPainter p;

  // equals if height() == 1
  if(start > end) {
    // draw last line (since I can't resize to (width(), 0)
    p.begin(&buffer);
    p.setPen( whiteCol );
    p.drawLine( 0, 0, paint_width, 0);
    p.end();

    // the rest is not of interest to us
    return;
  }

  end++;

  // we will only draw in this area
  const QRect area (QPoint(0, paint_y), QPoint(paint_width, end * ENTRY_HEIGHT));

  p.begin( &buffer );
  p.fillRect(area, whiteCol);

  KSVDragData* localO;
  QPixmap* drawnIcon = 0;

  for (int i = start; i < end; ++i) {
    // we will do everything with this KSVDragData object
    localO = list.at(i);

    if ( origin && !noFocus && i == focus ) {
      paint_back = hiCol;
      paint_text = hiText;

      drawnIcon = &selIcon;

      //      p.setBackgroundMode( OpaqueMode );
      p.fillRect( 14 + defaultIcon.width() + 4, paint_y + 2,
		  p.fontMetrics().width(localO->currentName()) + 2,
		  ENTRY_HEIGHT - 4, paint_back );

      //      p.setBackgroundMode( TransparentMode );

    } else {
      paint_back = whiteCol;
      paint_text = blackCol;

      drawnIcon = &defaultIcon;
    }

    // paint the label & icon
    if (localO->isNew())
      p.setPen(_newColor);
    else if (localO->isChanged())
      p.setPen(_changedColor);
    else
      p.setPen( blackCol );

    p.setFont( italic );
    p.drawText( 1, paint_y + 14, QString().sprintf("%.2i", localO->number()));
    p.drawPixmap( QPoint( 17, paint_y + 2), *drawnIcon );

    p.setPen( paint_text );
    p.setFont( KGlobal::generalFont() );
    p.drawText( 15 + (*drawnIcon).width() + 4, paint_y + 14, localO->currentName() );

    // move next picture down...
    paint_y += paint_height;
  }

  p.end();

  bitBlt( this, area.topLeft(), &buffer, area );
}


ksysv'KSVDragListCanvas::addPMenu() (./kdeadmin/ksysv/DragListCanvas.cpp:588)

void KSVDragListCanvas::addPMenu( QPopupMenu* menu ) {
  popup = menu;
}


ksysv'KSVDragListCanvas::selectItem() (./kdeadmin/ksysv/DragListCanvas.cpp:592)

void KSVDragListCanvas::selectItem( int val ) {
  if (val == NONE) {
    noFocus = TRUE;
  } else {
    noFocus = FALSE;
    oldFocus = focus;
    focus = val < count() ? val : count();
  }

  redrawFocus();

  if (noFocus)
    emit selected(0);
}


ksysv'KSVDragListCanvas::find() (./kdeadmin/ksysv/DragListCanvas.cpp:607)

int KSVDragListCanvas::find( const KSVDragData* o ) const
{
  return ((KSVList)list).find(o);
}


ksysv'KSVDragListCanvas::keyReleaseEvent() (./kdeadmin/ksysv/DragListCanvas.cpp:612)

void KSVDragListCanvas::keyReleaseEvent( QKeyEvent* e ) {

  switch( e->key() ) {                    // Look at the key code

  default:                              // If not an interesting key,
    e->ignore();                        // we don't accept the event
    return;
  }
}


ksysv'KSVDragListCanvas::withinLimits() (./kdeadmin/ksysv/DragListCanvas.cpp:622)

bool KSVDragListCanvas::withinLimits( int x, int y ) const {
  return ((0 <= x <= width()) && (0 <= y <= height()) ? TRUE : FALSE);
}


ksysv'KSVDragListCanvas::generateNumber() (./kdeadmin/ksysv/DragListCanvas.cpp:626)

int KSVDragListCanvas::generateNumber( const int index ) {
  register int result;
  KSVDragData* high = list.at(index);
  KSVDragData* low = list.at(index - 1);

  // ugly
  if (!low && !high)
    return 50;

  if (!low)
    result = high->number() / 2;
  else if (!high)
    result = (100 - low->number()) / 2 + low->number();
  else
    result = (high->number() - low->number()) / 2 + low->number();

   if ((high && result == high->number()) || (low && result == low->number()))
     result = -1;

  return result;
}


ksysv'KSVDragListCanvas::insertOK() (./kdeadmin/ksysv/DragListCanvas.cpp:648)

bool KSVDragListCanvas::insertOK( KSVDragData* data, const int where ) {
  const int tmp = list.find(data);

  if (tmp == -1)
    return TRUE;
  else
    return ((where == tmp || where - 1 == tmp) ? FALSE : TRUE);
}


ksysv'KSVDragListCanvas::focusItem() (./kdeadmin/ksysv/DragListCanvas.cpp:657)

int KSVDragListCanvas::focusItem() const {
  return focus;
}


ksysv'KSVDragListCanvas::redrawFocus() (./kdeadmin/ksysv/DragListCanvas.cpp:661)

void KSVDragListCanvas::redrawFocus() {
  if (oldFocus > -1)
    draw(oldFocus);
  if (focus > -1 && focus != oldFocus)
    draw(focus);
}


ksysv'KSVDragListCanvas::autoScrollTimer() (./kdeadmin/ksysv/DragListCanvas.cpp:668)

void KSVDragListCanvas::autoScrollTimer() {
  emit mouseMove(_lastPos.x(), _lastPos.y());
}


ksysv'KSVDragListCanvas::setNewColor() (./kdeadmin/ksysv/DragListCanvas.cpp:672)

void KSVDragListCanvas::setNewColor( const QColor& color ) {
  _newColor = color;
  draw();
}


ksysv'KSVDragListCanvas::setChangedColor() (./kdeadmin/ksysv/DragListCanvas.cpp:677)

void KSVDragListCanvas::setChangedColor( const QColor& color ) {
  _changedColor = color;
  draw();
}


ksysv'KSVDragListCanvas::reSort() (./kdeadmin/ksysv/DragListCanvas.cpp:682)

void KSVDragListCanvas::reSort()
{
  list.reSort();
  draw();
}