* 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

@ -40,6 +40,12 @@ DirectoriesDialog::DirectoriesDialog(QWidget *parent)
connect(ui.incomingButton, SIGNAL(clicked( bool ) ), this , SLOT( setIncomingDirectory() ) ); connect(ui.incomingButton, SIGNAL(clicked( bool ) ), this , SLOT( setIncomingDirectory() ) );
connect(ui.partialButton, SIGNAL(clicked( bool ) ), this , SLOT( setPartialsDirectory() ) ); 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"));
/* Hide platform specific features */ /* Hide platform specific features */
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
@ -88,8 +94,10 @@ void DirectoriesDialog::addShareDirectory()
/* select a dir /* select a dir
*/ */
int ind;
QString qdir = QFileDialog::getOpenFileName(this, tr("Add Shared Directory"),tr("All Files (*)")); QString qdir = QFileDialog::getExistingDirectory(this, tr("Add Shared Directory"), "",
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
ind=qdir.lastIndexOf("/");
/* add it to the server */ /* add it to the server */
std::string dir = qdir.toStdString(); std::string dir = qdir.toStdString();

View File

@ -109,7 +109,7 @@ void ShareFilesDialog::remove_File()
bool ShareFilesDialog::messageBoxOk(QString msg) 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.setButtonText( QMessageBox::Ok, "OK" );
mb.exec(); mb.exec();
return true; return true;

View File

@ -114,6 +114,7 @@ void ShareManager::addShareDirectory()
{ {
rsFiles->addSharedDirectory(dir); rsFiles->addSharedDirectory(dir);
load(); load();
messageBoxOk("Shared Directory Added!");
} }
} }
@ -123,13 +124,30 @@ void ShareManager::removeShareDirectory()
/* ask for removal */ /* ask for removal */
QListWidget *listWidget = ui.shareddirList; QListWidget *listWidget = ui.shareddirList;
QListWidgetItem *qdir = listWidget -> currentItem(); QListWidgetItem *qdir = listWidget -> currentItem();
QString queryWrn;
queryWrn.clear();
queryWrn.append("Do You Want to Delete ? ");
if (qdir) if (qdir)
{
if ((QMessageBox::question(this, tr("Warning!"),queryWrn,QMessageBox::Ok|QMessageBox::No, QMessageBox::Ok))== QMessageBox::Ok)
{ {
rsFiles->removeSharedDirectory( qdir->text().toStdString()); rsFiles->removeSharedDirectory( qdir->text().toStdString());
load(); 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 */ /** Loads the settings for this page */
void load(); void load();
bool messageBoxOk(QString);
public slots: public slots:
protected: protected: