From b57cdeb4fc623917ce3ce2c3c02f6d16d26987c6 Mon Sep 17 00:00:00 2001 From: defnax Date: Tue, 6 Jan 2009 22:35:22 +0000 Subject: [PATCH] * Added QMessagesBox feature for the ShareManager's Add/Remove * Fixed DirectoriesDialogs's Add Folder method. * Set ToolTips for The DirectoriesDialogs's Buttons git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@916 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- .../src/gui/Preferences/DirectoriesDialog.cpp | 28 ++++++++++++------- retroshare-gui/src/gui/ShareFilesDialog.cpp | 2 +- retroshare-gui/src/gui/ShareManager.cpp | 22 +++++++++++++-- retroshare-gui/src/gui/ShareManager.h | 2 ++ 4 files changed, 41 insertions(+), 13 deletions(-) diff --git a/retroshare-gui/src/gui/Preferences/DirectoriesDialog.cpp b/retroshare-gui/src/gui/Preferences/DirectoriesDialog.cpp index 754e16d9f..22fe8c4c9 100644 --- a/retroshare-gui/src/gui/Preferences/DirectoriesDialog.cpp +++ b/retroshare-gui/src/gui/Preferences/DirectoriesDialog.cpp @@ -29,16 +29,22 @@ DirectoriesDialog::DirectoriesDialog(QWidget *parent) : ConfigPage(parent) { - /* Invoke the Qt Designer generated object setup routine */ - ui.setupUi(this); + /* Invoke the Qt Designer generated object setup routine */ + ui.setupUi(this); - /* Create RshareSettings object */ - _settings = new RshareSettings(); + /* Create RshareSettings object */ + _settings = new RshareSettings(); + + connect(ui.addButton, SIGNAL(clicked( bool ) ), this , SLOT( addShareDirectory() ) ); + connect(ui.removeButton, SIGNAL(clicked( bool ) ), this , SLOT( removeShareDirectory() ) ); + connect(ui.incomingButton, SIGNAL(clicked( bool ) ), this , SLOT( setIncomingDirectory() ) ); + connect(ui.partialButton, SIGNAL(clicked( bool ) ), this , SLOT( setPartialsDirectory() ) ); + + ui.addButton->setToolTip(tr("Add a Share Directory")); + ui.removeButton->setToolTip(tr("Remove Shared Directory")); + ui.incomingButton->setToolTip(tr("Browse")); + ui.partialButton->setToolTip(tr("Erowse")); - connect(ui.addButton, SIGNAL(clicked( bool ) ), this , SLOT( addShareDirectory() ) ); - connect(ui.removeButton, SIGNAL(clicked( bool ) ), this , SLOT( removeShareDirectory() ) ); - connect(ui.incomingButton, SIGNAL(clicked( bool ) ), this , SLOT( setIncomingDirectory() ) ); - connect(ui.partialButton, SIGNAL(clicked( bool ) ), this , SLOT( setPartialsDirectory() ) ); /* Hide platform specific features */ @@ -88,8 +94,10 @@ void DirectoriesDialog::addShareDirectory() /* select a dir */ - - QString qdir = QFileDialog::getOpenFileName(this, tr("Add Shared Directory"),tr("All Files (*)")); + int ind; + QString qdir = QFileDialog::getExistingDirectory(this, tr("Add Shared Directory"), "", + QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); + ind=qdir.lastIndexOf("/"); /* add it to the server */ std::string dir = qdir.toStdString(); diff --git a/retroshare-gui/src/gui/ShareFilesDialog.cpp b/retroshare-gui/src/gui/ShareFilesDialog.cpp index 91bc13094..f7e52f37c 100644 --- a/retroshare-gui/src/gui/ShareFilesDialog.cpp +++ b/retroshare-gui/src/gui/ShareFilesDialog.cpp @@ -109,7 +109,7 @@ void ShareFilesDialog::remove_File() bool ShareFilesDialog::messageBoxOk(QString msg) { - QMessageBox mb("files and itz names!",msg,QMessageBox::Information,QMessageBox::Ok,0,0); + QMessageBox mb("Share Manager MessageBox",msg,QMessageBox::Information,QMessageBox::Ok,0,0); mb.setButtonText( QMessageBox::Ok, "OK" ); mb.exec(); return true; diff --git a/retroshare-gui/src/gui/ShareManager.cpp b/retroshare-gui/src/gui/ShareManager.cpp index 781405c08..a82e48e6b 100644 --- a/retroshare-gui/src/gui/ShareManager.cpp +++ b/retroshare-gui/src/gui/ShareManager.cpp @@ -114,6 +114,7 @@ void ShareManager::addShareDirectory() { rsFiles->addSharedDirectory(dir); load(); + messageBoxOk("Shared Directory Added!"); } } @@ -123,13 +124,30 @@ void ShareManager::removeShareDirectory() /* ask for removal */ QListWidget *listWidget = ui.shareddirList; QListWidgetItem *qdir = listWidget -> currentItem(); + + QString queryWrn; + queryWrn.clear(); + queryWrn.append("Do You Want to Delete ? "); if (qdir) { - rsFiles->removeSharedDirectory( qdir->text().toStdString()); - load(); + if ((QMessageBox::question(this, tr("Warning!"),queryWrn,QMessageBox::Ok|QMessageBox::No, QMessageBox::Ok))== QMessageBox::Ok) + { + rsFiles->removeSharedDirectory( qdir->text().toStdString()); + load(); + } + else + return; + } } +bool ShareManager::messageBoxOk(QString msg) + { + QMessageBox mb("Share Manager InfoBox!",msg,QMessageBox::Information,QMessageBox::Ok,0,0); + mb.setButtonText( QMessageBox::Ok, "OK" ); + mb.exec(); + return true; + } diff --git a/retroshare-gui/src/gui/ShareManager.h b/retroshare-gui/src/gui/ShareManager.h index 29047d5cc..a3639fec9 100644 --- a/retroshare-gui/src/gui/ShareManager.h +++ b/retroshare-gui/src/gui/ShareManager.h @@ -39,6 +39,8 @@ public: /** Loads the settings for this page */ void load(); + bool messageBoxOk(QString); + public slots: protected: