* 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
This commit is contained in:
defnax 2009-01-06 22:35:22 +00:00
parent 5a3403a3a0
commit b57cdeb4fc
4 changed files with 41 additions and 13 deletions

View File

@ -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();

View File

@ -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;

View File

@ -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;
}

View File

@ -39,6 +39,8 @@ public:
/** Loads the settings for this page */
void load();
bool messageBoxOk(QString);
public slots:
protected: