proper update of shared list when list is modiffied from a different place

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1363 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
alexandrut 2009-07-12 21:03:26 +00:00
parent 17374bf299
commit fe2934f6db
2 changed files with 17 additions and 14 deletions

View File

@ -15,7 +15,7 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, * Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
****************************************************************/ ****************************************************************/
#include "ShareManager.h" #include "ShareManager.h"
@ -52,7 +52,7 @@ ShareManager::ShareManager(QWidget *parent, Qt::WFlags flags)
ui.addButton->setToolTip(tr("Add a Share Directory")); ui.addButton->setToolTip(tr("Add a Share Directory"));
ui.removeButton->setToolTip(tr("Remove selected Shared Directory")); ui.removeButton->setToolTip(tr("Remove selected Shared Directory"));
load(); load();
} }
@ -78,13 +78,13 @@ void ShareManager::load()
std::list<std::string>::const_iterator it; std::list<std::string>::const_iterator it;
std::list<std::string> dirs; std::list<std::string> dirs;
rsFiles->getSharedDirectories(dirs); rsFiles->getSharedDirectories(dirs);
/* get a link to the table */ /* get a link to the table */
QListWidget *listWidget = ui.shareddirList; QListWidget *listWidget = ui.shareddirList;
/* remove old items ??? */ /* remove old items ??? */
listWidget->clear(); listWidget->clear();
for(it = dirs.begin(); it != dirs.end(); it++) for(it = dirs.begin(); it != dirs.end(); it++)
{ {
/* (0) Dir Name */ /* (0) Dir Name */
@ -92,7 +92,7 @@ void ShareManager::load()
} }
//ui.incomingDir->setText(QString::fromStdString(rsFiles->getDownloadDirectory())); //ui.incomingDir->setText(QString::fromStdString(rsFiles->getDownloadDirectory()));
listWidget->update(); /* update display */ listWidget->update(); /* update display */
@ -107,7 +107,7 @@ void ShareManager::addShareDirectory()
QString qdir = QFileDialog::getExistingDirectory(this, tr("Add Shared Directory"), "", QString qdir = QFileDialog::getExistingDirectory(this, tr("Add Shared Directory"), "",
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
/* add it to the server */ /* add it to the server */
std::string dir = qdir.toStdString(); std::string dir = qdir.toStdString();
if (dir != "") if (dir != "")
@ -149,8 +149,10 @@ bool ShareManager::messageBoxOk(QString msg)
return true; return true;
} }
void ShareManager::showEvent(QShowEvent *event)
{
if (!event->spontaneous())
{
load();
}
}

View File

@ -15,7 +15,7 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, * Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
****************************************************************/ ****************************************************************/
@ -44,6 +44,7 @@ public:
public slots: public slots:
protected: protected:
virtual void showEvent(QShowEvent * event);
private slots: private slots:
@ -52,7 +53,7 @@ private slots:
void addShareDirectory(); void addShareDirectory();
void removeShareDirectory(); void removeShareDirectory();
private: private: