projects
/
quassel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
cd99779
)
The input line is now enabled disabled correctly according to the current buffer...
author
Marcus Eggenberger
<egs@quassel-irc.org>
Mon, 18 Feb 2008 13:16:26 +0000
(13:16 +0000)
committer
Marcus Eggenberger
<egs@quassel-irc.org>
Mon, 18 Feb 2008 13:16:26 +0000
(13:16 +0000)
src/client/networkmodel.cpp
patch
|
blob
|
history
src/client/networkmodel.h
patch
|
blob
|
history
src/qtui/inputwidget.cpp
patch
|
blob
|
history
src/qtui/inputwidget.h
patch
|
blob
|
history
version.inc
patch
|
blob
|
history
diff --git
a/src/client/networkmodel.cpp
b/src/client/networkmodel.cpp
index
be13afd
..
3e380d4
100644
(file)
--- a/
src/client/networkmodel.cpp
+++ b/
src/client/networkmodel.cpp
@@
-42,6
+42,11
@@
BufferItem::BufferItem(BufferInfo bufferInfo, AbstractTreeItem *parent)
Qt::ItemFlags flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled;
if(bufferType() == BufferInfo::QueryBuffer)
flags |= Qt::ItemIsDropEnabled;
Qt::ItemFlags flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled;
if(bufferType() == BufferInfo::QueryBuffer)
flags |= Qt::ItemIsDropEnabled;
+
+ if(bufferType() == BufferInfo::StatusBuffer) {
+ NetworkItem *networkItem = qobject_cast<NetworkItem *>(parent);
+ connect(networkItem, SIGNAL(dataChanged()), this, SIGNAL(dataChanged()));
+ }
setFlags(flags);
}
setFlags(flags);
}
@@
-221,7
+226,12
@@
void BufferItem::part(IrcUser *ircUser) {
}
void BufferItem::removeUserFromCategory(IrcUser *ircUser) {
}
void BufferItem::removeUserFromCategory(IrcUser *ircUser) {
- Q_ASSERT(_ircChannel);
+ if(!_ircChannel) {
+ // If we parted the channel there might still be some ircUsers connected.
+ // in that case we just ignore the call
+ Q_ASSERT(childCount() == 0);
+ return;
+ }
bool success = false;
UserCategoryItem *categoryItem = 0;
bool success = false;
UserCategoryItem *categoryItem = 0;
@@
-311,11
+321,6
@@
quint64 NetworkItem::id() const {
return qHash(_networkId);
}
return qHash(_networkId);
}
-void NetworkItem::setActive(bool connected) {
- Q_UNUSED(connected);
- emit dataChanged();
-}
-
bool NetworkItem::isActive() const {
if(_network)
return _network->isConnected();
bool NetworkItem::isActive() const {
if(_network)
return _network->isConnected();
@@
-357,7
+362,7
@@
void NetworkItem::attachNetwork(Network *network) {
connect(network, SIGNAL(ircChannelAdded(QString)),
this, SLOT(attachIrcChannel(QString)));
connect(network, SIGNAL(connectedSet(bool)),
connect(network, SIGNAL(ircChannelAdded(QString)),
this, SLOT(attachIrcChannel(QString)));
connect(network, SIGNAL(connectedSet(bool)),
- this, S
LOT(setActive(bool
)));
+ this, S
IGNAL(dataChanged(
)));
// FIXME: connect this and that...
// FIXME: connect this and that...
diff --git
a/src/client/networkmodel.h
b/src/client/networkmodel.h
index
961c1ca
..
41e5f1d
100644
(file)
--- a/
src/client/networkmodel.h
+++ b/
src/client/networkmodel.h
@@
-110,6
+110,7
@@
public:
NetworkItem(const NetworkId &netid, AbstractTreeItem *parent = 0);
virtual quint64 id() const;
NetworkItem(const NetworkId &netid, AbstractTreeItem *parent = 0);
virtual quint64 id() const;
+ inline const NetworkId &networkId() const { return _networkId; }
virtual QVariant data(int column, int row) const;
bool isActive() const;
virtual QVariant data(int column, int row) const;
bool isActive() const;
@@
-124,8
+125,6
@@
public slots:
void attachNetwork(Network *network);
void attachIrcChannel(const QString &channelName);
void attachNetwork(Network *network);
void attachIrcChannel(const QString &channelName);
-
- void setActive(bool connected);
private:
NetworkId _networkId;
private:
NetworkId _networkId;
diff --git
a/src/qtui/inputwidget.cpp
b/src/qtui/inputwidget.cpp
index
0745d66
..
0f4a7ee
100644
(file)
--- a/
src/qtui/inputwidget.cpp
+++ b/
src/qtui/inputwidget.cpp
@@
-43,7
+43,12
@@
InputWidget::~InputWidget() {
}
void InputWidget::setModel(BufferModel *bufferModel) {
}
void InputWidget::setModel(BufferModel *bufferModel) {
+ if(_bufferModel) {
+ disconnect(_bufferModel, 0, this, 0);
+ }
_bufferModel = bufferModel;
_bufferModel = bufferModel;
+ connect(bufferModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)),
+ this, SLOT(dataChanged(QModelIndex, QModelIndex)));
}
void InputWidget::setSelectionModel(QItemSelectionModel *selectionModel) {
}
void InputWidget::setSelectionModel(QItemSelectionModel *selectionModel) {
@@
-74,6
+79,15
@@
void InputWidget::currentChanged(const QModelIndex ¤t, const QModelIndex &
ui.inputEdit->setEnabled(current.data(NetworkModel::ItemActiveRole).value<bool>());
}
ui.inputEdit->setEnabled(current.data(NetworkModel::ItemActiveRole).value<bool>());
}
+void InputWidget::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) {
+ QItemSelectionRange changedArea(topLeft, bottomRight);
+ QModelIndex currentIndex = Client::bufferModel()->currentIndex();
+ if(changedArea.contains(currentIndex)) {
+ ui.inputEdit->setEnabled(currentIndex.data(NetworkModel::ItemActiveRole).value<bool>());
+ }
+};
+
+
const Network *InputWidget::currentNetwork() const {
if(!validBuffer)
return 0;
const Network *InputWidget::currentNetwork() const {
if(!validBuffer)
return 0;
diff --git
a/src/qtui/inputwidget.h
b/src/qtui/inputwidget.h
index
86a7693
..
70449d2
100644
(file)
--- a/
src/qtui/inputwidget.h
+++ b/
src/qtui/inputwidget.h
@@
-49,7
+49,7
@@
protected slots:
// virtual void closeEditor(QWidget *editor, QAbstractItemDelegate::EndEditHint hint);
// virtual void commitData(QWidget *editor);
virtual void currentChanged(const QModelIndex ¤t, const QModelIndex &previous);
// virtual void closeEditor(QWidget *editor, QAbstractItemDelegate::EndEditHint hint);
// virtual void commitData(QWidget *editor);
virtual void currentChanged(const QModelIndex ¤t, const QModelIndex &previous);
-
//
virtual void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
+ virtual void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
// virtual void editorDestroyed(QObject *editor);
// virtual void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
// virtual void rowsInserted(const QModelIndex &parent, int start, int end);
// virtual void editorDestroyed(QObject *editor);
// virtual void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
// virtual void rowsInserted(const QModelIndex &parent, int start, int end);
diff --git
a/version.inc
b/version.inc
index
62ba353
..
329e0ff
100644
(file)
--- a/
version.inc
+++ b/
version.inc
@@
-5,7
+5,7
@@
quasselVersion = "0.2.0-pre";
quasselDate = "2008-02-18";
quasselVersion = "0.2.0-pre";
quasselDate = "2008-02-18";
- quasselBuild = 53
0
;
+ quasselBuild = 53
1
;
//! Minimum client build number the core needs
clientBuildNeeded = 526;
//! Minimum client build number the core needs
clientBuildNeeded = 526;