projects
/
quassel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Set current time on creation of MessageEvents if no other time is given
[quassel.git]
/
src
/
client
/
treemodel.cpp
diff --git
a/src/client/treemodel.cpp
b/src/client/treemodel.cpp
index
36cb8d6
..
6ab70e6
100644
(file)
--- a/
src/client/treemodel.cpp
+++ b/
src/client/treemodel.cpp
@@
-1,5
+1,5
@@
/***************************************************************************
/***************************************************************************
- * Copyright (C) 2005-0
8
by the Quassel Project *
+ * Copyright (C) 2005-0
9
by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
@@
-127,6
+127,10
@@
void AbstractTreeItem::customEvent(QEvent *event) {
if(childRow == -1)
return;
if(childRow == -1)
return;
+ // since we are called asynchronously we have to recheck if the item in question still has no childs
+ if(removeEvent->child()->childCount())
+ return;
+
removeChild(childRow);
}
removeChild(childRow);
}
@@
-301,15
+305,15
@@
TreeModel::TreeModel(const QList<QVariant> &data, QObject *parent)
if(Quassel::isOptionSet("debugmodel")) {
connect(this, SIGNAL(rowsAboutToBeInserted(const QModelIndex &, int, int)),
if(Quassel::isOptionSet("debugmodel")) {
connect(this, SIGNAL(rowsAboutToBeInserted(const QModelIndex &, int, int)),
- this, SLOT(debug_rowsAboutToBeInserted(const QModelIndex &, int, int)));
+
this, SLOT(debug_rowsAboutToBeInserted(const QModelIndex &, int, int)));
connect(this, SIGNAL(rowsAboutToBeRemoved(const QModelIndex &, int, int)),
connect(this, SIGNAL(rowsAboutToBeRemoved(const QModelIndex &, int, int)),
- this, SLOT(debug_rowsAboutToBeRemoved(const QModelIndex &, int, int)));
+
this, SLOT(debug_rowsAboutToBeRemoved(const QModelIndex &, int, int)));
connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
- this, SLOT(debug_rowsInserted(const QModelIndex &, int, int)));
+
this, SLOT(debug_rowsInserted(const QModelIndex &, int, int)));
connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
- this, SLOT(debug_rowsRemoved(const QModelIndex &, int, int)));
+
this, SLOT(debug_rowsRemoved(const QModelIndex &, int, int)));
connect(this, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)),
connect(this, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)),
- this, SLOT(debug_dataChanged(const QModelIndex &, const QModelIndex &)));
+
this, SLOT(debug_dataChanged(const QModelIndex &, const QModelIndex &)));
}
}
}
}
@@
-318,7
+322,7
@@
TreeModel::~TreeModel() {
}
QModelIndex TreeModel::index(int row, int column, const QModelIndex &parent) const {
}
QModelIndex TreeModel::index(int row, int column, const QModelIndex &parent) const {
- if(
!hasIndex(row, column,
parent))
+ if(
row < 0 || row >= rowCount(parent) || column < 0 || column >= columnCount(
parent))
return QModelIndex();
AbstractTreeItem *parentItem;
return QModelIndex();
AbstractTreeItem *parentItem;
@@
-350,7
+354,8
@@
QModelIndex TreeModel::indexByItem(AbstractTreeItem *item) const {
QModelIndex TreeModel::parent(const QModelIndex &index) const {
if(!index.isValid()) {
QModelIndex TreeModel::parent(const QModelIndex &index) const {
if(!index.isValid()) {
- qWarning() << "TreeModel::parent(): has been asked for the rootItems Parent!";
+ // ModelTest does this
+ // qWarning() << "TreeModel::parent(): has been asked for the rootItems Parent!";
return QModelIndex();
}
return QModelIndex();
}
@@
-442,23
+447,23
@@
void TreeModel::itemDataChanged(int column) {
void TreeModel::connectItem(AbstractTreeItem *item) {
connect(item, SIGNAL(dataChanged(int)),
void TreeModel::connectItem(AbstractTreeItem *item) {
connect(item, SIGNAL(dataChanged(int)),
- this, SLOT(itemDataChanged(int)));
+
this, SLOT(itemDataChanged(int)));
connect(item, SIGNAL(beginAppendChilds(int, int)),
connect(item, SIGNAL(beginAppendChilds(int, int)),
- this, SLOT(beginAppendChilds(int, int)));
+
this, SLOT(beginAppendChilds(int, int)));
connect(item, SIGNAL(endAppendChilds()),
connect(item, SIGNAL(endAppendChilds()),
- this, SLOT(endAppendChilds()));
+
this, SLOT(endAppendChilds()));
connect(item, SIGNAL(beginRemoveChilds(int, int)),
connect(item, SIGNAL(beginRemoveChilds(int, int)),
- this, SLOT(beginRemoveChilds(int, int)));
+
this, SLOT(beginRemoveChilds(int, int)));
connect(item, SIGNAL(endRemoveChilds()),
connect(item, SIGNAL(endRemoveChilds()),
- this, SLOT(endRemoveChilds()));
+
this, SLOT(endRemoveChilds()));
}
void TreeModel::beginAppendChilds(int firstRow, int lastRow) {
AbstractTreeItem *parentItem = qobject_cast<AbstractTreeItem *>(sender());
if(!parentItem) {
}
void TreeModel::beginAppendChilds(int firstRow, int lastRow) {
AbstractTreeItem *parentItem = qobject_cast<AbstractTreeItem *>(sender());
if(!parentItem) {
- qWarning() << "TreeModel::beginAppendChilds(): cannot append Child
s
to unknown parent";
+ qWarning() << "TreeModel::beginAppendChilds(): cannot append Child
ren
to unknown parent";
return;
}
return;
}
@@
-473,7
+478,7
@@
void TreeModel::beginAppendChilds(int firstRow, int lastRow) {
void TreeModel::endAppendChilds() {
AbstractTreeItem *parentItem = qobject_cast<AbstractTreeItem *>(sender());
if(!parentItem) {
void TreeModel::endAppendChilds() {
AbstractTreeItem *parentItem = qobject_cast<AbstractTreeItem *>(sender());
if(!parentItem) {
- qWarning() << "TreeModel::endAppendChilds(): cannot append Child
s
to unknown parent";
+ qWarning() << "TreeModel::endAppendChilds(): cannot append Child
ren
to unknown parent";
return;
}
Q_ASSERT(_aboutToRemoveOrInsert);
return;
}
Q_ASSERT(_aboutToRemoveOrInsert);
@@
-492,7
+497,7
@@
void TreeModel::endAppendChilds() {
void TreeModel::beginRemoveChilds(int firstRow, int lastRow) {
AbstractTreeItem *parentItem = qobject_cast<AbstractTreeItem *>(sender());
if(!parentItem) {
void TreeModel::beginRemoveChilds(int firstRow, int lastRow) {
AbstractTreeItem *parentItem = qobject_cast<AbstractTreeItem *>(sender());
if(!parentItem) {
- qWarning() << "TreeModel::beginRemoveChilds(): cannot append Child
s
to unknown parent";
+ qWarning() << "TreeModel::beginRemoveChilds(): cannot append Child
ren
to unknown parent";
return;
}
return;
}
@@
-514,7
+519,7
@@
void TreeModel::beginRemoveChilds(int firstRow, int lastRow) {
void TreeModel::endRemoveChilds() {
AbstractTreeItem *parentItem = qobject_cast<AbstractTreeItem *>(sender());
if(!parentItem) {
void TreeModel::endRemoveChilds() {
AbstractTreeItem *parentItem = qobject_cast<AbstractTreeItem *>(sender());
if(!parentItem) {
- qWarning() << "TreeModel::endRemoveChilds(): cannot remove Child
s
from unknown parent";
+ qWarning() << "TreeModel::endRemoveChilds(): cannot remove Child
ren
from unknown parent";
return;
}
return;
}