added "join channel" to network context menu in the bufferview (bug 122)
authorAlexander von Renteln <phon@quassel-irc.org>
Thu, 28 Feb 2008 17:32:02 +0000 (17:32 +0000)
committerAlexander von Renteln <phon@quassel-irc.org>
Thu, 28 Feb 2008 17:32:02 +0000 (17:32 +0000)
src/client/client.h
src/uisupport/bufferview.cpp
version.inc

index 4d1bad6..30a3d16 100644 (file)
@@ -62,6 +62,8 @@ public:
   static Buffer *buffer(BufferInfo);
   static inline Buffer *monitorBuffer() { return instance()->_monitorBuffer; }
 
   static Buffer *buffer(BufferInfo);
   static inline Buffer *monitorBuffer() { return instance()->_monitorBuffer; }
 
+  Buffer *statusBuffer(const NetworkId &networkid) const;
+
   static QList<NetworkId> networkIds();
   static const Network * network(NetworkId);
 
   static QList<NetworkId> networkIds();
   static const Network * network(NetworkId);
 
@@ -193,8 +195,6 @@ private:
   static void setCurrentCoreAccount(AccountId);
   static inline BufferSyncer *bufferSyncer() { return instance()->_bufferSyncer; }
 
   static void setCurrentCoreAccount(AccountId);
   static inline BufferSyncer *bufferSyncer() { return instance()->_bufferSyncer; }
 
-  Buffer *statusBuffer(const NetworkId &networkid) const;
-
   static QPointer<Client> instanceptr;
 
   QPointer<QIODevice> socket;
   static QPointer<Client> instanceptr;
 
   QPointer<QIODevice> socket;
index d83f696..d4deeea 100644 (file)
@@ -153,6 +153,7 @@ void BufferView::showContextMenu(const QPoint &pos) {
   QMenu contextMenu(this);
   QAction *connectNetAction = new QAction(tr("Connect"), this);
   QAction *disconnectNetAction = new QAction(tr("Disconnect"), this);
   QMenu contextMenu(this);
   QAction *connectNetAction = new QAction(tr("Connect"), this);
   QAction *disconnectNetAction = new QAction(tr("Disconnect"), this);
+  QAction *joinChannelAction = new QAction(tr("Join Channel"), this);
 
   QAction *joinBufferAction = new QAction(tr("Join"), this);
   QAction *partBufferAction = new QAction(tr("Part"), this);
 
   QAction *joinBufferAction = new QAction(tr("Join"), this);
   QAction *partBufferAction = new QAction(tr("Part"), this);
@@ -182,6 +183,8 @@ void BufferView::showContextMenu(const QPoint &pos) {
   if(index.data(NetworkModel::ItemTypeRole) == NetworkModel::NetworkItemType) {
     if(index.data(NetworkModel::ItemActiveRole).toBool()) {
       contextMenu.addAction(disconnectNetAction);
   if(index.data(NetworkModel::ItemTypeRole) == NetworkModel::NetworkItemType) {
     if(index.data(NetworkModel::ItemActiveRole).toBool()) {
       contextMenu.addAction(disconnectNetAction);
+      contextMenu.addSeparator();
+      contextMenu.addAction(joinChannelAction);
     } else {
       contextMenu.addAction(connectNetAction);
     }
     } else {
       contextMenu.addAction(connectNetAction);
     }
@@ -204,6 +207,7 @@ void BufferView::showContextMenu(const QPoint &pos) {
         removeBufferAction->setEnabled(false);
         removeBufferAction->setToolTip("To delete the buffer, part the channel first.");
         joinBufferAction->setVisible(false);
         removeBufferAction->setEnabled(false);
         removeBufferAction->setToolTip("To delete the buffer, part the channel first.");
         joinBufferAction->setVisible(false);
+        whoBufferAction->setVisible(false);
       } else {
         partBufferAction->setVisible(false);
       }
       } else {
         partBufferAction->setVisible(false);
       }
@@ -222,6 +226,18 @@ void BufferView::showContextMenu(const QPoint &pos) {
     else 
       network->requestDisconnect();
   } else
     else 
       network->requestDisconnect();
   } else
+  if(result == joinChannelAction) {
+    bool ok;
+    QString channelName = QInputDialog::getText(this, tr("Join Channel"), 
+                                                tr("Input channel name:"),QLineEdit::Normal,
+                                                QDir::home().dirName(), &ok);
+    if (ok && !channelName.isEmpty()) {
+      const Buffer *statusbuffer = Client::instance()->statusBuffer(index.data(NetworkModel::NetworkIdRole).value<NetworkId>());
+      if(statusbuffer) {
+        Client::instance()->userInput(statusbuffer->bufferInfo(), QString("/J %1").arg(channelName));
+      }
+    }
+  } else
   if(result == joinBufferAction) {
     Client::instance()->userInput(bufferInfo, QString("/JOIN %1").arg(channelname));
   } else
   if(result == joinBufferAction) {
     Client::instance()->userInput(bufferInfo, QString("/JOIN %1").arg(channelname));
   } else
index 244d8df..a9c6054 100644 (file)
@@ -5,7 +5,7 @@
 
   quasselVersion = "0.2.0-alpha1+";
   quasselDate = "2008-02-27";
 
   quasselVersion = "0.2.0-alpha1+";
   quasselDate = "2008-02-27";
-  quasselBuild = 593;
+  quasselBuild = 595;
 
   //! Minimum client build number the core needs
   clientBuildNeeded = 563;
 
   //! Minimum client build number the core needs
   clientBuildNeeded = 563;