mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
* added context menu for Share Manager to can remove a Shared Directory
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@900 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
526a5c2cdb
commit
8ba3c2de28
@ -22,10 +22,18 @@
|
||||
|
||||
#include "rsiface/rsfiles.h"
|
||||
|
||||
|
||||
#include <QContextMenuEvent>
|
||||
#include <QMenu>
|
||||
#include <QCursor>
|
||||
#include <QPoint>
|
||||
#include <QMouseEvent>
|
||||
#include <QPixmap>
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
/* Images for context menu icons */
|
||||
#define IMAGE_CANCEL ":/images/delete.png"
|
||||
|
||||
/** Default constructor */
|
||||
ShareManager::ShareManager(QWidget *parent, Qt::WFlags flags)
|
||||
: QDialog(parent, flags)
|
||||
@ -39,12 +47,31 @@ ShareManager::ShareManager(QWidget *parent, Qt::WFlags flags)
|
||||
connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
|
||||
connect( ui.shareddirList, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( shareddirListCostumPopupMenu( QPoint ) ) );
|
||||
|
||||
|
||||
ui.addButton->setToolTip(tr("Add a Share Directory"));
|
||||
ui.removeButton->setToolTip(tr("Remove selected Shared Directory"));
|
||||
|
||||
load();
|
||||
|
||||
}
|
||||
|
||||
void ShareManager::shareddirListCostumPopupMenu( QPoint point )
|
||||
{
|
||||
|
||||
QMenu contextMnu( this );
|
||||
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
|
||||
|
||||
removeAct = new QAction(QIcon(IMAGE_CANCEL), tr( "Remove" ), this );
|
||||
connect( removeAct , SIGNAL( triggered() ), this, SLOT( removeShareDirectory() ) );
|
||||
|
||||
|
||||
contextMnu.clear();
|
||||
contextMnu.addAction( removeAct );
|
||||
contextMnu.exec( mevent->globalPos() );
|
||||
}
|
||||
|
||||
/** Loads the settings for this page */
|
||||
void ShareManager::load()
|
||||
{
|
||||
|
@ -40,14 +40,26 @@ public:
|
||||
/** Loads the settings for this page */
|
||||
void load();
|
||||
public slots:
|
||||
|
||||
protected:
|
||||
|
||||
private slots:
|
||||
|
||||
void addShareDirectory();
|
||||
void removeShareDirectory();
|
||||
/** Create the context popup menu and it's submenus */
|
||||
void shareddirListCostumPopupMenu( QPoint point );
|
||||
|
||||
void addShareDirectory();
|
||||
void removeShareDirectory();
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
/** Define the popup menus for the Context menu */
|
||||
QMenu* contextMnu;
|
||||
/** Defines the actions for the context menu */
|
||||
QAction* removeAct;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::ShareManager ui;
|
||||
};
|
||||
|
@ -10,7 +10,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Add Share Manager</string>
|
||||
<string>RetroShare Share Manager</string>
|
||||
</property>
|
||||
<property name="windowIcon" >
|
||||
<iconset resource="images.qrc" >:/images/rstray3.png</iconset>
|
||||
@ -60,7 +60,11 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QListWidget" name="shareddirList" />
|
||||
<widget class="QListWidget" name="shareddirList" >
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
Loading…
Reference in New Issue
Block a user