From 9eafd88c77ded186bc4a38bf0ee977bfb02254e4 Mon Sep 17 00:00:00 2001 From: csoler Date: Fri, 24 May 2013 12:45:35 +0000 Subject: [PATCH] fixed missing dialog box for channel custom directory git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6377 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/ChannelFeed.cpp | 19 ++++++++++++++++++- retroshare-gui/src/gui/ChannelFeed.h | 1 + 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/ChannelFeed.cpp b/retroshare-gui/src/gui/ChannelFeed.cpp index f2fbfb843..903a84850 100644 --- a/retroshare-gui/src/gui/ChannelFeed.cpp +++ b/retroshare-gui/src/gui/ChannelFeed.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -206,6 +207,7 @@ void ChannelFeed::channelListCustomPopupMenu( QPoint /*point*/ ) QAction *specifyDestinationDirectoryAct = new QAction(QIcon(":/images/filefind.png"), tr("Other..."), &contextMnu); directoryMenu->addAction(specifyDestinationDirectoryAct); + connect(specifyDestinationDirectoryAct,SIGNAL(triggered()),this,SLOT(chooseDestinationDirectory())) ; // Now get the list of existing directories. @@ -241,8 +243,10 @@ void ChannelFeed::channelListCustomPopupMenu( QPoint /*point*/ ) directoryMenu->addAction(defaultDestinationDirectoryAct); - if(!found) + if(ci.destination_directory.empty()) defaultDestinationDirectoryAct->setIcon(QIcon(":/images/start.png")) ; + else if(!found) + specifyDestinationDirectoryAct->setIcon(QIcon(":/images/start.png")) ; } if(ci.channelFlags & RS_DISTRIB_SUBSCRIBED) @@ -279,7 +283,20 @@ void ChannelFeed::setDestinationDirectory() std::cerr << "Setting new directory " << dest_dir << " to channel " << mChannelId << std::endl; rsChannels->channelSetDestinationDirectory(mChannelId,dest_dir) ; } +void ChannelFeed::chooseDestinationDirectory() +{ + ChannelInfo ci; + if (!rsChannels->getChannelInfo(mChannelId, ci)) + return; + QString dirname = QFileDialog::getExistingDirectory(NULL,tr("Select channel destination directory"),QString::fromStdString(ci.destination_directory),QFileDialog::ShowDirsOnly) ; + + if(dirname.isNull()) + return ; + + std::cerr << "Setting new directory " << dirname.toStdString() << " to channel " << mChannelId << std::endl; + rsChannels->channelSetDestinationDirectory(mChannelId,dirname.toStdString()) ; +} void ChannelFeed::createChannel() { CreateChannel *cf = new CreateChannel(); diff --git a/retroshare-gui/src/gui/ChannelFeed.h b/retroshare-gui/src/gui/ChannelFeed.h index 4ed710777..a92c4f811 100644 --- a/retroshare-gui/src/gui/ChannelFeed.h +++ b/retroshare-gui/src/gui/ChannelFeed.h @@ -80,6 +80,7 @@ private slots: void shareKey(); void copyChannelLink(); void setDestinationDirectory(); + void chooseDestinationDirectory(); void channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status);