Channels:

- Use destination directory when manually downloading a file from a channel
- Show destination directory in channel details
- Fixed utf8 issue when choosing the destination directory

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6902 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2013-11-16 13:21:25 +00:00
parent fc56b95d3f
commit c447ab2829
6 changed files with 61 additions and 13 deletions

View File

@ -310,13 +310,13 @@ void ChannelFeed::chooseDestinationDirectory()
if (!rsChannels->getChannelInfo(mChannelId, ci))
return;
QString dirname = QFileDialog::getExistingDirectory(NULL,tr("Select channel destination directory"),QString::fromStdString(ci.destination_directory),QFileDialog::ShowDirsOnly) ;
QString dirname = QFileDialog::getExistingDirectory(NULL,tr("Select channel destination directory"),QString::fromUtf8(ci.destination_directory.c_str()),QFileDialog::ShowDirsOnly) ;
if(dirname.isNull())
return ;
std::cerr << "Setting new directory " << dirname.toStdString() << " to channel " << mChannelId << std::endl;
rsChannels->channelSetDestinationDirectory(mChannelId,dirname.toStdString()) ;
rsChannels->channelSetDestinationDirectory(mChannelId, dirname.toUtf8().constData()) ;
}
void ChannelFeed::createChannel()
{

View File

@ -43,12 +43,6 @@ ChannelDetails::ChannelDetails(QWidget *parent)
connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(close()));
ui.nameline ->setReadOnly(true);
ui.popline ->setReadOnly(true);
ui.postline ->setReadOnly(true);
ui.IDline ->setReadOnly(true);
ui.DescriptiontextEdit ->setReadOnly(true);
ui.typeEncrypted->setEnabled(false);
ui.typePrivate->setEnabled(false);
}
@ -114,4 +108,7 @@ void ChannelDetails::loadChannel()
ui.typeEncrypted->setChecked(true);
ui.typePrivate->setChecked(false);
}
// Set destination directory
ui.destinationDirectoryLineEdit->setText(QString::fromUtf8(ci.destination_directory.c_str()));
}

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>455</width>
<height>408</height>
<height>417</height>
</rect>
</property>
<property name="windowTitle">
@ -46,7 +46,11 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="nameline"/>
<widget class="QLineEdit" name="nameline">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_10">
@ -84,7 +88,11 @@
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="IDline"/>
<widget class="QLineEdit" name="IDline">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox">
@ -93,7 +101,11 @@
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QTextEdit" name="DescriptiontextEdit"/>
<widget class="QTextEdit" name="DescriptiontextEdit">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox_3">
@ -121,6 +133,20 @@
</layout>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Destination directory</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="destinationDirectoryLineEdit">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -141,6 +167,18 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>stabWidget</tabstop>
<tabstop>nameline</tabstop>
<tabstop>popline</tabstop>
<tabstop>postline</tabstop>
<tabstop>IDline</tabstop>
<tabstop>destinationDirectoryLineEdit</tabstop>
<tabstop>DescriptiontextEdit</tabstop>
<tabstop>typePrivate</tabstop>
<tabstop>typeEncrypted</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources>
<include location="../images.qrc"/>
</resources>

View File

@ -208,6 +208,7 @@ void ChanMsgItem::updateItemStatic()
/* add file */
SubFileItem *fi = new SubFileItem(it->hash, it->fname, it->path, it->size,
SFI_STATE_REMOTE | SFI_TYPE_CHANNEL, "");
fi->setChannelId(mChanId);
mFileItems.push_back(fi);
/* check if the file is a media file */

View File

@ -31,6 +31,7 @@
#include "util/misc.h"
#include "gui/RetroShareLink.h"
#include <retroshare/rschannels.h>
/****
* #define DEBUG_ITEM 1
@ -599,6 +600,14 @@ void SubFileItem::download()
std::list<std::string> sources ;
std::string destination;
if (!mChannelId.empty() && mType == SFI_TYPE_CHANNEL) {
ChannelInfo ci;
if (rsChannels->getChannelInfo(mChannelId, ci)) {
destination = ci.destination_directory;
}
}
// Add possible direct sources.
//
FileInfo finfo ;
@ -614,7 +623,7 @@ void SubFileItem::download()
if (mSrcId != "")
sources.push_back(mSrcId);
rsFiles->FileRequest(mFileName, mFileHash, mFileSize, "", RS_FILE_REQ_ANONYMOUS_ROUTING, sources);
rsFiles->FileRequest(mFileName, mFileHash, mFileSize, destination, RS_FILE_REQ_ANONYMOUS_ROUTING, sources);
downloadButton->setEnabled(false);

View File

@ -73,6 +73,8 @@ public:
bool isDownloadable(bool &startable);
bool isPlayable(bool &startable);
void setChannelId(const std::string &channelId) { mChannelId = channelId; }
public slots:
void download();
void play();
@ -95,6 +97,7 @@ private:
std::string mFileName;
uint64_t mFileSize;
std::string mSrcId;
std::string mChannelId;
uint32_t mMode;
uint32_t mType;