mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
commit
1824da11b0
@ -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);
|
||||
|
@ -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();
|
||||
|
||||
|
@ -6,12 +6,21 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>464</width>
|
||||
<height>71</height>
|
||||
<width>547</width>
|
||||
<height>128</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
@ -26,27 +35,6 @@
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="fileLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<italic>true</italic>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">File Name</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
@ -210,6 +198,41 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="deleteButton">
|
||||
<property name="toolTip">
|
||||
<string>Remove this item</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/denied16.png</normaloff>:/images/denied16.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="fileLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<italic>true</italic>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">File Name</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -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<SubFileItem *>(QObject::sender());
|
||||
|
||||
for(std::list<SubFileItem*>::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 */
|
||||
|
@ -60,6 +60,7 @@ protected:
|
||||
private slots:
|
||||
void addExtraFile();
|
||||
void checkAttachmentReady();
|
||||
void deleteAttachment();
|
||||
|
||||
void cancelMsg();
|
||||
void sendMsg();
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>581</width>
|
||||
<height>479</height>
|
||||
<width>875</width>
|
||||
<height>659</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="acceptDrops">
|
||||
@ -60,7 +60,7 @@
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="channelPostTab">
|
||||
<attribute name="title">
|
||||
@ -302,8 +302,8 @@ p, li { white-space: pre-wrap; }
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>523</width>
|
||||
<height>24</height>
|
||||
<width>767</width>
|
||||
<height>42</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>828</width>
|
||||
<width>880</width>
|
||||
<height>557</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -184,20 +184,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="editButton">
|
||||
<property name="toolTip">
|
||||
<string>Edit current post</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/edit_24.png</normaloff>:/images/edit_24.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
|
Loading…
Reference in New Issue
Block a user