From fe2934f6db685f5666f71ecc1f27d65e395ac066 Mon Sep 17 00:00:00 2001 From: alexandrut Date: Sun, 12 Jul 2009 21:03:26 +0000 Subject: [PATCH] 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 --- retroshare-gui/src/gui/ShareManager.cpp | 26 +++++++++++++------------ retroshare-gui/src/gui/ShareManager.h | 5 +++-- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/retroshare-gui/src/gui/ShareManager.cpp b/retroshare-gui/src/gui/ShareManager.cpp index b5094b4e4..cf71923a3 100644 --- a/retroshare-gui/src/gui/ShareManager.cpp +++ b/retroshare-gui/src/gui/ShareManager.cpp @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * 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. ****************************************************************/ #include "ShareManager.h" @@ -52,7 +52,7 @@ ShareManager::ShareManager(QWidget *parent, Qt::WFlags flags) ui.addButton->setToolTip(tr("Add a Share Directory")); ui.removeButton->setToolTip(tr("Remove selected Shared Directory")); - + load(); } @@ -78,13 +78,13 @@ void ShareManager::load() std::list::const_iterator it; std::list dirs; rsFiles->getSharedDirectories(dirs); - + /* get a link to the table */ QListWidget *listWidget = ui.shareddirList; - + /* remove old items ??? */ listWidget->clear(); - + for(it = dirs.begin(); it != dirs.end(); it++) { /* (0) Dir Name */ @@ -92,7 +92,7 @@ void ShareManager::load() } //ui.incomingDir->setText(QString::fromStdString(rsFiles->getDownloadDirectory())); - + listWidget->update(); /* update display */ @@ -107,7 +107,7 @@ void ShareManager::addShareDirectory() QString qdir = QFileDialog::getExistingDirectory(this, tr("Add Shared Directory"), "", QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); - + /* add it to the server */ std::string dir = qdir.toStdString(); if (dir != "") @@ -149,8 +149,10 @@ bool ShareManager::messageBoxOk(QString msg) return true; } - - - - - +void ShareManager::showEvent(QShowEvent *event) +{ + if (!event->spontaneous()) + { + load(); + } +} diff --git a/retroshare-gui/src/gui/ShareManager.h b/retroshare-gui/src/gui/ShareManager.h index a3639fec9..fb4bab5eb 100644 --- a/retroshare-gui/src/gui/ShareManager.h +++ b/retroshare-gui/src/gui/ShareManager.h @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * 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. ****************************************************************/ @@ -44,6 +44,7 @@ public: public slots: protected: + virtual void showEvent(QShowEvent * event); private slots: @@ -52,7 +53,7 @@ private slots: void addShareDirectory(); void removeShareDirectory(); - + private: