Mainly this fixes a crash on reconnect, because ToolBarActionProvider didn't clean
up its state after disconnecting. Now the relevant classes have slots for connecting
and disconnecting that can be reimplemented if necessary.
A better solution is probably polling Client's state rather than using slots, but for
now this should be ok.
void QtUi::disconnectedFromCore() {
_mainWin->disconnectedFromCore();
+ GraphicalUi::disconnectedFromCore();
}
void QtUi::useSystemTrayChanged(const QVariant &v) {
#include "actioncollection.h"
#include "contextmenuactionprovider.h"
+#include "toolbaractionprovider.h"
#ifdef Q_WS_X11
# include <QX11Info>
_uiStyle = style;
}
+void GraphicalUi::disconnectedFromCore() {
+ _contextMenuActionProvider->disconnectedFromCore();
+ _toolBarActionProvider->disconnectedFromCore();
+ AbstractUi::disconnectedFromCore();
+}
+
bool GraphicalUi::eventFilter(QObject *obj, QEvent *event) {
#ifdef Q_WS_WIN
if(obj == mainWidget() && event->type() == QEvent::ActivationChange) {
virtual bool eventFilter(QObject *obj, QEvent *event);
+protected slots:
+ virtual void disconnectedFromCore();
+
private:
static inline GraphicalUi *instance();
};
Q_DECLARE_FLAGS(ItemActiveStates, ItemActiveState)
+public slots:
+ virtual void connectedToCore() {}
+ virtual void disconnectedFromCore() {}
+
protected:
inline ActionCollection *actionCollection() const;
inline QList<QModelIndex> indexList() const;
}
+void ToolBarActionProvider::disconnectedFromCore() {
+ _currentBuffer = QModelIndex();
+ updateStates();
+ NetworkModelController::disconnectedFromCore();
+}
+
void ToolBarActionProvider::updateStates() {
action(BufferPart)->setEnabled(_currentBuffer.isValid()
&& _currentBuffer.data(NetworkModel::BufferTypeRole) == BufferInfo::ChannelBuffer
void addActions(QToolBar *, ToolBarType type);
+public slots:
+ virtual void disconnectedFromCore();
+
protected:
virtual void handleNetworkAction(ActionType, QAction *);
virtual void handleBufferAction(ActionType, QAction *);