diff --git a/retroshare-gui/src/gui/ChannelFeed.cpp b/retroshare-gui/src/gui/ChannelFeed.cpp index 218c6aa41..53bac81be 100644 --- a/retroshare-gui/src/gui/ChannelFeed.cpp +++ b/retroshare-gui/src/gui/ChannelFeed.cpp @@ -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() { diff --git a/retroshare-gui/src/gui/channels/ChannelDetails.cpp b/retroshare-gui/src/gui/channels/ChannelDetails.cpp index e45622c5d..b5b5e57ec 100644 --- a/retroshare-gui/src/gui/channels/ChannelDetails.cpp +++ b/retroshare-gui/src/gui/channels/ChannelDetails.cpp @@ -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())); } diff --git a/retroshare-gui/src/gui/channels/ChannelDetails.ui b/retroshare-gui/src/gui/channels/ChannelDetails.ui index f7c15c02e..34f5760bc 100644 --- a/retroshare-gui/src/gui/channels/ChannelDetails.ui +++ b/retroshare-gui/src/gui/channels/ChannelDetails.ui @@ -7,7 +7,7 @@ 0 0 455 - 408 + 417 @@ -46,7 +46,11 @@ - + + + true + + @@ -84,7 +88,11 @@ - + + + true + + @@ -93,7 +101,11 @@ - + + + true + + @@ -121,6 +133,20 @@ + + + + Destination directory + + + + + + + true + + + @@ -141,6 +167,18 @@ + + stabWidget + nameline + popline + postline + IDline + destinationDirectoryLineEdit + DescriptiontextEdit + typePrivate + typeEncrypted + buttonBox + diff --git a/retroshare-gui/src/gui/feeds/ChanMsgItem.cpp b/retroshare-gui/src/gui/feeds/ChanMsgItem.cpp index 51244a8d1..11964ae1c 100644 --- a/retroshare-gui/src/gui/feeds/ChanMsgItem.cpp +++ b/retroshare-gui/src/gui/feeds/ChanMsgItem.cpp @@ -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 */ diff --git a/retroshare-gui/src/gui/feeds/SubFileItem.cpp b/retroshare-gui/src/gui/feeds/SubFileItem.cpp index 47389ac6d..8fe74c5eb 100644 --- a/retroshare-gui/src/gui/feeds/SubFileItem.cpp +++ b/retroshare-gui/src/gui/feeds/SubFileItem.cpp @@ -31,6 +31,7 @@ #include "util/misc.h" #include "gui/RetroShareLink.h" +#include /**** * #define DEBUG_ITEM 1 @@ -599,6 +600,14 @@ void SubFileItem::download() std::list 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); diff --git a/retroshare-gui/src/gui/feeds/SubFileItem.h b/retroshare-gui/src/gui/feeds/SubFileItem.h index c15d731ca..6ecd5e97b 100644 --- a/retroshare-gui/src/gui/feeds/SubFileItem.h +++ b/retroshare-gui/src/gui/feeds/SubFileItem.h @@ -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;