From cda4adbf5bca764e7c1783b0ac59c825fa7da79c Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 17 Jul 2012 21:22:37 +0000 Subject: [PATCH] moved channel action menu into right click, for better consistency git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5309 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/ChannelFeed.cpp | 49 ++++----- retroshare-gui/src/gui/ChannelFeed.ui | 136 +------------------------ 2 files changed, 19 insertions(+), 166 deletions(-) diff --git a/retroshare-gui/src/gui/ChannelFeed.cpp b/retroshare-gui/src/gui/ChannelFeed.cpp index 8fe5e8af1..25cf71bc0 100644 --- a/retroshare-gui/src/gui/ChannelFeed.cpp +++ b/retroshare-gui/src/gui/ChannelFeed.cpp @@ -62,11 +62,6 @@ ChannelFeed::ChannelFeed(QWidget *parent) connect(newChannelButton, SIGNAL(clicked()), this, SLOT(createChannel())); connect(postButton, SIGNAL(clicked()), this, SLOT(createMsg())); - connect(subscribeButton, SIGNAL( clicked( void ) ), this, SLOT( subscribeChannel ( void ) ) ); - connect(unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeChannel ( void ) ) ); - connect(actionsetAllAsRead, SIGNAL(triggered()), this, SLOT(setAllAsReadClicked())); - connect(actionEnable_Auto_Download, SIGNAL(triggered()), this, SLOT(toggleAutoDownload())); - connect(NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int))); /*************** Setup Left Hand Side (List of Channels) ****************/ @@ -89,11 +84,6 @@ ChannelFeed::ChannelFeed(QWidget *parent) popularChannels = treeWidget->addCategoryItem(tr("Popular Channels"), QIcon(), false); otherChannels = treeWidget->addCategoryItem(tr("Other Channels"), QIcon(), false); - QMenu * channeloptsmenu = new QMenu(); - channeloptsmenu->addAction(actionsetAllAsRead); - channeloptsmenu->addAction(actionEnable_Auto_Download); - channeloptions_Button->setMenu(channeloptsmenu); - progressLabel->hide(); progressBar->hide(); @@ -162,6 +152,17 @@ void ChannelFeed::channelListCustomPopupMenu( QPoint /*point*/ ) QAction *unsubscribechannelAct = new QAction(QIcon(":/images/cancel.png"), tr( "Unsubscribe to Channel" ), &contextMnu); connect( unsubscribechannelAct , SIGNAL( triggered() ), this, SLOT( unsubscribeChannel() ) ); + QAction *setallasreadchannelAct = new QAction(QIcon(":/images/message-mail-read.png"), tr( "Set all as read" ), &contextMnu); + connect( setallasreadchannelAct , SIGNAL( triggered() ), this, SLOT( setAllAsReadClicked() ) ); + + bool autoDl = false; + rsChannels->channelGetAutoDl(mChannelId, autoDl); + + QAction *autochannelAct = autoDl? (new QAction(QIcon(":/images/redled.png"), tr( "Disable Auto-Download" ), &contextMnu)) + : (new QAction(QIcon(":/images/start.png"),tr( "Enable Auto-Download" ), &contextMnu)) ; + + connect( autochannelAct , SIGNAL( triggered() ), this, SLOT( toggleAutoDownload() ) ); + QAction *channeldetailsAct = new QAction(QIcon(":/images/info16.png"), tr( "Show Channel Details" ), &contextMnu); connect( channeldetailsAct , SIGNAL( triggered() ), this, SLOT( showChannelDetails() ) ); @@ -187,11 +188,17 @@ void ChannelFeed::channelListCustomPopupMenu( QPoint /*point*/ ) contextMnu.addAction( channeldetailsAct ); contextMnu.addAction( shareKeyAct ); contextMnu.addAction( restoreKeysAct ); + contextMnu.addSeparator(); + contextMnu.addAction( autochannelAct ); + contextMnu.addAction( setallasreadchannelAct ); } else if (ci.channelFlags & RS_DISTRIB_SUBSCRIBED) { contextMnu.addAction( unsubscribechannelAct ); contextMnu.addSeparator(); contextMnu.addAction( channeldetailsAct ); contextMnu.addAction( restoreKeysAct ); + contextMnu.addSeparator(); + contextMnu.addAction( autochannelAct ); + contextMnu.addAction( setallasreadchannelAct ); } else { contextMnu.addAction( subscribechannelAct ); contextMnu.addSeparator(); @@ -199,6 +206,7 @@ void ChannelFeed::channelListCustomPopupMenu( QPoint /*point*/ ) contextMnu.addAction( restoreKeysAct ); } + contextMnu.addSeparator(); QAction *action = contextMnu.addAction(QIcon(":/images/copyrslink.png"), tr("Copy RetroShare Link"), this, SLOT(copyChannelLink())); action->setEnabled(!mChannelId.empty()); @@ -471,12 +479,6 @@ void ChannelFeed::updateChannelMsgs() ChannelInfo ci; if (!rsChannels->getChannelInfo(mChannelId, ci)) { postButton->setEnabled(false); - subscribeButton->setEnabled(false); - unsubscribeButton->setEnabled(false); - subscribeButton->hide(); - unsubscribeButton->hide(); - actionsetAllAsRead->setEnabled(false); - actionEnable_Auto_Download->setEnabled(false); nameLabel->setText(tr("No Channel Selected")); iconLabel->setPixmap(QPixmap(":/images/channels.png")); iconLabel->setEnabled(false); @@ -502,21 +504,6 @@ void ChannelFeed::updateChannelMsgs() QString cname = QString::fromStdWString(ci.channelName); nameLabel->setText(channelStr.arg(cname)); - /* do buttons */ - if (ci.channelFlags & RS_DISTRIB_SUBSCRIBED) { - subscribeButton->setEnabled(false); - subscribeButton->hide(); - unsubscribeButton->show(); - unsubscribeButton->setEnabled(true); - actionsetAllAsRead->setEnabled(true); - } else { - subscribeButton->setEnabled(true); - subscribeButton->show(); - unsubscribeButton->setEnabled(false); - unsubscribeButton->hide(); - actionsetAllAsRead->setEnabled(false); - } - if (ci.channelFlags & RS_DISTRIB_PUBLISH) { postButton->setEnabled(true); } else { diff --git a/retroshare-gui/src/gui/ChannelFeed.ui b/retroshare-gui/src/gui/ChannelFeed.ui index f534028bc..e382105c2 100644 --- a/retroshare-gui/src/gui/ChannelFeed.ui +++ b/retroshare-gui/src/gui/ChannelFeed.ui @@ -298,100 +298,6 @@ p, li { white-space: pre-wrap; } 2 - - - - - 0 - 0 - - - - - 0 - 26 - - - - Unsubcribe To Channel - - - QToolButton, QPushButton, QComboBox { -border-image: url(:/images/btn_26.png) 4; -border-width: 4; -padding: 0px 6px; -font-size: 12px; -} - -QToolButton:hover, QPushButton:hover, QComboBox:hover { -border-image: url(:/images/btn_26_hover.png) 4; -} - -QToolButton:disabled, QPushButton:disabled, QComboBox::disabled { -color:gray; -} - -QToolButton:pressed, QPushButton:pressed{ -border-image: url(:/images/btn_26_pressed.png) 4; -} - - - Unsubscribe - - - - - - - - 0 - 0 - - - - - 0 - 26 - - - - - 16777215 - 26 - - - - Subscribe To Channel - - - QToolButton, QPushButton, QComboBox { -border-image: url(:/images/btn_26.png) 4; -border-width: 4; -padding: 0px 6px; -font-size: 12px; -} - -QToolButton:hover, QPushButton:hover, QComboBox:hover { -border-image: url(:/images/btn_26_hover.png) 4; -} - -QToolButton:disabled, QPushButton:disabled, QComboBox::disabled { -color:gray; -} - -QToolButton:pressed, QPushButton:pressed{ -border-image: url(:/images/btn_26_pressed.png) 4; -} - - - Subscribe - - - - :/images/konqsidebar_news16.png:/images/konqsidebar_news16.png - - - @@ -463,46 +369,6 @@ border-image: url(:/images/btn_26_pressed.png) 4; - - - - - 0 - 26 - - - - QToolButton, QPushButton, QComboBox { -border-image: url(:/images/btn_26.png) 4; -border-width: 4; -padding: 0px 6px; -font-size: 12px; -} - -QToolButton:hover, QPushButton:hover, QComboBox:hover { -border-image: url(:/images/btn_26_hover.png) 4; -} - -QToolButton:disabled, QPushButton:disabled, QComboBox::disabled { -color:gray; -} - -QToolButton:pressed, QPushButton:pressed{ -border-image: url(:/images/btn_26_pressed.png) 4; -} - - - - - - - :/images/kcmsystem24.png:/images/kcmsystem24.png - - - true - - - @@ -518,7 +384,7 @@ border-image: url(:/images/btn_26_pressed.png) 4; 0 0 - 400 + 395 16