Improve marker line behavior; allow manual setting (Ctrl+R)
[quassel.git] / src / qtui / mainwin.cpp
index dce01f3..9c58f75 100644 (file)
@@ -313,8 +313,9 @@ void MainWin::setupActions() {
                                           this, SLOT(showCoreInfoDlg())));
   coll->addAction("ConfigureNetworks", new Action(SmallIcon("configure"), tr("Configure &Networks..."), coll,
                                               this, SLOT(on_actionConfigureNetworks_triggered())));
+  // FIXME: use QKeySequence::Quit once we depend on Qt 4.6
   coll->addAction("Quit", new Action(SmallIcon("application-exit"), tr("&Quit"), coll,
-                                      this, SLOT(quit()), QKeySequence::Quit));
+                                     this, SLOT(quit()), Qt::CTRL + Qt::Key_Q));
 
   // View
   coll->addAction("ConfigureBufferViews", new Action(tr("&Configure Chat Lists..."), coll,
@@ -490,6 +491,11 @@ void MainWin::removeBufferView(int bufferViewConfigId) {
 }
 
 void MainWin::bufferViewToggled(bool enabled) {
+  if(!enabled && !isVisible()) {
+    // hiding the mainwindow triggers a toggle of the bufferview (which pretty much sucks big time)
+    // since this isn't our fault and we can't do anything about it, we suppress the resulting calls
+    return;
+  }
   QAction *action = qobject_cast<QAction *>(sender());
   Q_ASSERT(action);
   BufferViewDock *dock = qobject_cast<BufferViewDock *>(action->parent());
@@ -501,23 +507,6 @@ void MainWin::bufferViewToggled(bool enabled) {
 
   if(enabled) {
     Client::bufferViewOverlay()->addView(dock->bufferViewId());
-    BufferViewConfig *config = dock->config();
-    if(config && config->isInitialized()) {
-      BufferIdList buffers;
-      if(config->networkId().isValid()) {
-        foreach(BufferId bufferId, config->bufferList()) {
-          if(Client::networkModel()->networkId(bufferId) == config->networkId())
-            buffers << bufferId;
-        }
-        foreach(BufferId bufferId, config->temporarilyRemovedBuffers().toList()) {
-          if(Client::networkModel()->networkId(bufferId) == config->networkId())
-            buffers << bufferId;
-        }
-      } else {
-        buffers = BufferIdList::fromSet(config->bufferList().toSet() + config->temporarilyRemovedBuffers());
-      }
-      Client::backlogManager()->checkForBacklog(buffers);
-    }
   } else {
     Client::bufferViewOverlay()->removeView(dock->bufferViewId());
   }
@@ -800,7 +789,6 @@ void MainWin::disconnectedFromCore() {
     if(dock && actionData.toInt() != -1) {
       removeAction(action);
       _bufferViews.removeAll(dock);
-      Client::bufferViewOverlay()->removeView(dock->bufferViewId());
       dock->deleteLater();
     }
   }
@@ -995,7 +983,7 @@ bool MainWin::event(QEvent *event) {
   if(event->type() == QEvent::WindowActivate) {
     BufferId buffer = Client::bufferModel()->currentBuffer();
     if(buffer.isValid())
-      QtUi::closeNotifications(buffer);
+      Client::instance()->markBufferAsRead(buffer);
   }
   return QMainWindow::event(event);
 }
@@ -1066,14 +1054,14 @@ void MainWin::messagesInserted(const QModelIndex &parent, int start, int end) {
       else
         type = AbstractNotificationBackend::HighlightFocused;
 
-      QtUi::invokeNotification(bufId, type, sender, contents);
+      QtUi::instance()->invokeNotification(bufId, type, sender, contents);
     }
   }
 }
 
 void MainWin::currentBufferChanged(BufferId buffer) {
   if(buffer.isValid())
-    QtUi::closeNotifications(buffer);
+    Client::instance()->markBufferAsRead(buffer);
 }
 
 void MainWin::clientNetworkCreated(NetworkId id) {