diff --git a/retroshare-gui/src/gui/feeds/SubFileItem.cpp b/retroshare-gui/src/gui/feeds/SubFileItem.cpp index f8451e5ee..ac4745ef8 100644 --- a/retroshare-gui/src/gui/feeds/SubFileItem.cpp +++ b/retroshare-gui/src/gui/feeds/SubFileItem.cpp @@ -97,11 +97,12 @@ SubFileItem::SubFileItem(const RsFileHash &hash, const std::string &name, const void SubFileItem::Setup() { - connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( play ( void ) ) ); - connect( downloadButton, SIGNAL( clicked( void ) ), this, SLOT( download ( void ) ) ); - connect( cancelButton, SIGNAL( clicked( void ) ), this, SLOT( cancel ( void ) ) ); - connect( copyLinkButton, SIGNAL( clicked( void ) ), this, SLOT( copyLink ( void ) ) ); - connect( saveButton, SIGNAL( clicked( void ) ), this, SLOT( save ( void ) ) ); + connect( playButton, SIGNAL( clicked( ) ), this, SLOT( play ( ) ) ); + connect( downloadButton, SIGNAL( clicked( ) ), this, SLOT( download ( ) ) ); + connect( cancelButton, SIGNAL( clicked( ) ), this, SLOT( cancel( ) ) ); + connect( deleteButton, SIGNAL( clicked( ) ), this, SLOT( del( ) ) ); + connect( copyLinkButton, SIGNAL( clicked( ) ), this, SLOT( copyLink ( ) ) ); + connect( saveButton, SIGNAL( clicked( ) ), this, SLOT( save ( ) ) ); /* once off check - if remote, check if we have it * NB: This check might be expensive - and it'll happen often! @@ -129,12 +130,19 @@ void SubFileItem::Setup() } } + deleteButton->setVisible(mFlag & SFI_FLAG_DELETE); + smaller(); updateItemStatic(); updateItem(); } +void SubFileItem::del() +{ + emit wantsToBeDeleted(); +} + bool SubFileItem::done() { return (mMode >= SFI_STATE_LOCAL); diff --git a/retroshare-gui/src/gui/feeds/SubFileItem.h b/retroshare-gui/src/gui/feeds/SubFileItem.h index c3e094882..fac68b792 100644 --- a/retroshare-gui/src/gui/feeds/SubFileItem.h +++ b/retroshare-gui/src/gui/feeds/SubFileItem.h @@ -41,6 +41,7 @@ const uint32_t SFI_TYPE_CHANNEL = 0x0010; const uint32_t SFI_TYPE_ATTACH = 0x0020; const uint32_t SFI_FLAG_CREATE = 0x1000; +const uint32_t SFI_FLAG_DELETE = 0x2000; //! This create a gui widget that allows users to access files shared by user @@ -86,10 +87,14 @@ private slots: void toggle(); void cancel(); + void del(); void save(); void updateItem(); +signals: + void wantsToBeDeleted(); + private: void Setup(); diff --git a/retroshare-gui/src/gui/feeds/SubFileItem.ui b/retroshare-gui/src/gui/feeds/SubFileItem.ui index 209f12ed8..d5c6b7181 100644 --- a/retroshare-gui/src/gui/feeds/SubFileItem.ui +++ b/retroshare-gui/src/gui/feeds/SubFileItem.ui @@ -6,12 +6,21 @@ 0 0 - 464 - 71 + 547 + 128 - + + 0 + + + 0 + + + 0 + + 0 @@ -26,27 +35,6 @@ QFrame::Sunken - - - - - - - 75 - true - true - - - - File Name - - - true - - - - - @@ -210,6 +198,41 @@ + + + + Remove this item + + + + + + + :/images/denied16.png:/images/denied16.png + + + + + + + + + + + + 75 + true + true + + + + File Name + + + true + + + diff --git a/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp b/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp index 507562840..bd17927a9 100644 --- a/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp +++ b/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp @@ -351,7 +351,7 @@ void CreateGxsChannelMsg::addAttachment(const RsFileHash &hash, const std::strin /* add widget in for new destination */ - uint32_t flags = SFI_TYPE_CHANNEL; + uint32_t flags = SFI_TYPE_CHANNEL | SFI_FLAG_DELETE; if (local) { flags |= SFI_STATE_LOCAL; @@ -363,6 +363,8 @@ void CreateGxsChannelMsg::addAttachment(const RsFileHash &hash, const std::strin SubFileItem *file = new SubFileItem(hash, fname, "", size, flags, srcId); // destroyed when fileFrame (this subfileitem) is destroyed + connect(file,SIGNAL(wantsToBeDeleted()),this,SLOT(deleteAttachment())) ; + mAttachments.push_back(file); QLayout *layout = fileFrame->layout(); layout->addWidget(file); @@ -375,6 +377,24 @@ void CreateGxsChannelMsg::addAttachment(const RsFileHash &hash, const std::strin return; } +void CreateGxsChannelMsg::deleteAttachment() +{ + // grab the item who sent the request + + SubFileItem *file_item = qobject_cast(QObject::sender()); + + for(std::list::iterator it(mAttachments.begin());it!=mAttachments.end();) + if(*it == file_item) + { + SubFileItem *item = *it ; + it = mAttachments.erase(it) ; + fileFrame->layout()->removeWidget(file_item) ; + delete item ; + } + else + ++it; +} + void CreateGxsChannelMsg::addExtraFile() { /* add a SubFileItem to the attachment section */ diff --git a/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.h b/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.h index 16cc76426..37404a23a 100644 --- a/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.h +++ b/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.h @@ -60,6 +60,7 @@ protected: private slots: void addExtraFile(); void checkAttachmentReady(); + void deleteAttachment(); void cancelMsg(); void sendMsg(); diff --git a/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.ui b/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.ui index c9e4c3346..180a79672 100644 --- a/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.ui +++ b/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.ui @@ -6,8 +6,8 @@ 0 0 - 581 - 479 + 875 + 659 @@ -60,7 +60,7 @@ false - 0 + 1 @@ -302,8 +302,8 @@ p, li { white-space: pre-wrap; } 0 0 - 523 - 24 + 767 + 42 diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.ui b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.ui index 2a5fdfcfa..47f98bcdf 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.ui +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.ui @@ -6,7 +6,7 @@ 0 0 - 828 + 880 557 @@ -184,20 +184,6 @@ - - - - Edit current post - - - ... - - - - :/images/edit_24.png:/images/edit_24.png - - -