return _bufferItemCache[bufferId]->lastSeenMarkerMsgId();
}
+MsgId NetworkModel::lastSeenMsgId(const BufferId &bufferId) {
+ BufferItem *bufferItem = findBufferItem(bufferId);
+ if(!bufferItem) {
+ qDebug() << "NetworkModel::lastSeenMsgId(): buffer is unknown:" << bufferId;
+ return MsgId();
+ }
+ return bufferItem->lastSeenMsgId();
+}
+
void NetworkModel::setLastSeenMsgId(const BufferId &bufferId, const MsgId &msgId) {
BufferItem *bufferItem = findBufferItem(bufferId);
if(!bufferItem) {
public slots:
void bufferUpdated(BufferInfo bufferInfo);
void removeBuffer(BufferId bufferId);
+ MsgId lastSeenMsgId(const BufferId &bufferId);
void setLastSeenMsgId(const BufferId &bufferId, const MsgId &msgId);
void setBufferActivity(const BufferId &bufferId, BufferInfo::ActivityLevel activity);
void clearBufferActivity(const BufferId &bufferId);
}
Core::~Core() {
+ _server.close();
+ _v6server.close();
foreach(QTcpSocket *socket, blocksizes.keys()) {
socket->disconnectFromHost(); // disconnect non authed clients
}
- qDeleteAll(sessions);
+
+
+ foreach(SessionThread *session, sessions) {
+ session->stopSession();
+ session->wait();
+ delete session;
+ qDebug() << "next";
+ }
+
+// qDeleteAll(sessions);
qDeleteAll(_storageBackends);
}
CoreNetwork::~CoreNetwork() {
if(connectionState() != Disconnected && connectionState() != Network::Reconnecting)
disconnectFromIrc(false); // clean up, but this does not count as requested disconnect!
+ else
+ socket.close();
disconnect(&socket, 0, this, 0); // this keeps the socket from triggering events during clean up
delete _ircServerHandler;
delete _userInputHandler;
}
SessionThread::~SessionThread() {
- // shut down thread gracefully
- quit();
- wait();
+ if(_session) {
+ _session->setParent(0);
+ _session->moveToThread(thread());
+ _session->deleteLater();
+ _session = 0;
+ }
}
CoreSession *SessionThread::session() {
emit initialized();
exec();
delete _session;
+ _session = 0;
}
+void SessionThread::stopSession() {
+ if(_session) {
+ connect(_session, SIGNAL(destroyed()), this, SLOT(quit()));
+ _session->deleteLater();
+ _session = 0;
+ }
+}
public slots:
void addClient(QObject *peer);
+ void stopSession();
private slots:
void setSessionInitialized();
set(SOURCES
aboutdlg.cpp
+ awaylogfilter.cpp
+ awaylogview.cpp
bufferwidget.cpp
channellistdlg.cpp
chatitem.cpp
set(MOC_HDRS
aboutdlg.h
+ awaylogfilter.h
+ awaylogview.h
bufferwidget.h
channellistdlg.h
chatitem.h
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-08 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) version 3. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include "awaylogfilter.h"
+
+AwayLogFilter::AwayLogFilter(MessageModel *model, QObject *parent)
+ : ChatMonitorFilter(model, parent)
+{
+}
+
+bool AwayLogFilter::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const {
+ Q_UNUSED(sourceParent)
+
+ QModelIndex source_index = sourceModel()->index(sourceRow, 0);
+
+ Message::Flags flags = (Message::Flags)source_index.data(MessageModel::FlagsRole).toInt();
+ if(!(flags & Message::Backlog && flags & Message::Highlight))
+ return false;
+
+ BufferId bufferId = source_index.data(MessageModel::BufferIdRole).value<BufferId>();
+ if(!bufferId.isValid()) {
+ return false;
+ }
+
+ if(Client::networkModel()->lastSeenMsgId(bufferId) >= source_index.data(MessageModel::MsgIdRole).value<MsgId>())
+ return false;
+
+ return true;
+}
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-08 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) version 3. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef AWAYLOGFILTER_H
+#define AWAYLOGFILTER_H
+
+#include "chatmonitorfilter.h"
+
+class AwayLogFilter : public ChatMonitorFilter {
+ Q_OBJECT
+
+public:
+ AwayLogFilter(MessageModel *model, QObject *parent = 0);
+
+ virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
+ virtual QString idString() const { return "AwayLog"; }
+};
+
+#endif //AWAYLOGFILTER_H
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-08 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) version 3. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include "awaylogview.h"
+
+#include <QAction>
+#include <QMenu>
+
+#include "awaylogfilter.h"
+#include "chatlinemodel.h"
+#include "chatscene.h"
+
+AwayLogView::AwayLogView(AwayLogFilter *filter, QWidget *parent)
+ : ChatMonitorView(filter, parent)
+{
+}
+
+void AwayLogView::addActionsToMenu(QMenu *menu, const QPointF &pos) {
+ ChatView::addActionsToMenu(menu, pos);
+ if(!menu->isEmpty())
+ menu->addSeparator();
+
+ if(scene()->columnByScenePos(pos) == ChatLineModel::SenderColumn) {
+ menu->addSeparator();
+
+ QAction *showNetworkAction = menu->addAction(tr("Show Network Name"), this, SLOT(showFieldsChanged(bool)));
+ showNetworkAction->setCheckable(true);
+ showNetworkAction->setChecked(filter()->showFields() & ChatMonitorFilter::NetworkField);
+ showNetworkAction->setData(ChatMonitorFilter::NetworkField);
+
+ QAction *showBufferAction = menu->addAction(tr("Show Buffer Name"), this, SLOT(showFieldsChanged(bool)));
+ showBufferAction->setCheckable(true);
+ showBufferAction->setChecked(filter()->showFields() & ChatMonitorFilter::BufferField);
+ showBufferAction->setData(ChatMonitorFilter::BufferField);
+ }
+}
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-08 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) version 3. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef AWAYLOGVIEW_H
+#define AWAYLOGVIEW_H
+
+#include "chatmonitorview.h"
+
+class AwayLogFilter;
+
+class AwayLogView : public ChatMonitorView {
+ Q_OBJECT
+
+public:
+ AwayLogView(AwayLogFilter *filter, QWidget *parent = 0);
+ virtual void addActionsToMenu(QMenu *menu, const QPointF &pos);
+};
+
+#endif //AWAYLOGVIEW_H
void showFieldsChanged(bool checked);
void showSettingsPage();
+protected:
+ inline ChatMonitorFilter *filter() const { return _filter; }
+
private:
ChatMonitorFilter *_filter;
};
#endif
#include "aboutdlg.h"
+#include "awaylogfilter.h"
+#include "awaylogview.h"
#include "action.h"
#include "actioncollection.h"
#include "buffermodel.h"
sslLabel(new QLabel()),
msgProcessorStatusWidget(new MsgProcessorStatusWidget()),
_titleSetter(this),
- _trayIcon(new QSystemTrayIcon(this))
+ _trayIcon(new QSystemTrayIcon(this)),
+ _awayLog(0)
{
QtUiSettings uiSettings;
QString style = uiSettings.value("Style", QString()).toString();
connect(lockAct, SIGNAL(toggled(bool)), SLOT(on_actionLockDockPositions_toggled(bool)));
coll->addAction("ToggleSearchBar", new Action(SmallIcon("edit-find"), tr("Show &Search Bar"), coll,
- 0, 0, tr("Ctrl+F")))->setCheckable(true);
+ 0, 0, tr("Ctrl+F")))->setCheckable(true);
+ coll->addAction("ShowAwayLog", new Action(tr("Show Away Log"), coll,
+ this, SLOT(showAwayLog())));
coll->addAction("ToggleStatusBar", new Action(tr("Show Status &Bar"), coll,
0, 0))->setCheckable(true);
_bufferViewsMenu->addAction(coll->action("ConfigureBufferViews"));
_viewMenu->addSeparator();
_viewMenu->addAction(coll->action("ToggleSearchBar"));
+ _viewMenu->addAction(coll->action("ShowAwayLog"));
_viewMenu->addAction(coll->action("ToggleStatusBar"));
_viewMenu->addSeparator();
_viewMenu->addAction(coll->action("LockDockPositions"));
CoreInfoDlg(this).exec();
}
+void MainWin::showAwayLog() {
+ if(_awayLog)
+ return;
+ AwayLogFilter *filter = new AwayLogFilter(Client::messageModel());
+ _awayLog = new AwayLogView(filter, 0);
+ filter->setParent(_awayLog);
+ connect(_awayLog, SIGNAL(destroyed()), this, SLOT(awayLogDestroyed()));
+ _awayLog->setAttribute(Qt::WA_DeleteOnClose);
+ _awayLog->show();
+}
+
+void MainWin::awayLogDestroyed() {
+ _awayLog = 0;
+}
+
void MainWin::showSettingsDlg() {
SettingsDlg *dlg = new SettingsDlg();
private slots:
void addBufferView(int bufferViewConfigId);
+ void awayLogDestroyed();
void removeBufferView(int bufferViewConfigId);
void messagesInserted(const QModelIndex &parent, int start, int end);
void showAboutDlg();
void startInternalCore();
void showCoreConnectionDlg(bool autoConnect = false);
void showCoreInfoDlg();
+ void showAwayLog();
void showSettingsDlg();
void showNotificationsDlg();
#ifdef HAVE_KDE
QMenu *_fileMenu, *_networksMenu, *_viewMenu, *_bufferViewsMenu, *_settingsMenu, *_helpMenu, *_helpDebugMenu;
+ QWidget *_awayLog;
friend class QtUi;
};