Skip to content
Permalink
Browse files

Added hidden option to disable add/edit in connect dialog (FR #1120)

When set removes add/edit options from the connect dialog.
This is meant to be used in occasions where the user isn't supposed
to change the set list of favourite servers.

On windows you can enable the option by creating a string key
disableconnectdialogediting under HKEY_CURRENT_USER\Software\Mumble\Mumble\ui
with the value true.
  • Loading branch information...
hacst committed Mar 13, 2014
1 parent fd5a9b1 commit 6a345f542c81b63b73ba33aea9aa09f1efdf6576
Showing with 31 additions and 11 deletions.
  1. +25 −11 src/mumble/ConnectDialog.cpp
  2. +3 −0 src/mumble/Settings.cpp
  3. +3 −0 src/mumble/Settings.h
@@ -800,13 +800,17 @@ ConnectDialog::ConnectDialog(QWidget *p, bool autoconnect) : QDialog(p), bAutoCo
connect(qpbAdd, SIGNAL(clicked()), qaFavoriteAddNew, SIGNAL(triggered()));
qdbbButtonBox->addButton(qpbAdd, QDialogButtonBox::ActionRole);


qpbEdit = new QPushButton(tr("&Edit..."), this);
qpbEdit->setEnabled(false);
qpbEdit->setDefault(false);
qpbEdit->setAutoDefault(false);
connect(qpbEdit, SIGNAL(clicked()), qaFavoriteEdit, SIGNAL(triggered()));
qdbbButtonBox->addButton(qpbEdit, QDialogButtonBox::ActionRole);

qpbAdd->setHidden(g.s.disableConnectDialogEditing);
qpbEdit->setHidden(g.s.disableConnectDialogEditing);

qtwServers->sortItems(1, Qt::AscendingOrder);

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
@@ -1117,20 +1121,30 @@ void ConnectDialog::on_qtwServers_customContextMenuRequested(const QPoint &mpos)
ServerItem *si = static_cast<ServerItem *>(qtwServers->itemAt(mpos));
qmPopup->clear();

if (si && si->bParent)
if (si != NULL && si->bParent) {
si = NULL;

if (si && (si->itType == ServerItem::FavoriteType)) {
qmPopup->addAction(qaFavoriteEdit);
qmPopup->addAction(qaFavoriteRemove);
} else if (si) {
qmPopup->addAction(qaFavoriteAdd);
}
if (si && ! si->qsUrl.isEmpty())
qmPopup->addAction(qaUrl);

if (! qmPopup->isEmpty())

if (si != NULL) {

if (!g.s.disableConnectDialogEditing) {
if (si->itType == ServerItem::FavoriteType) {
qmPopup->addAction(qaFavoriteEdit);
qmPopup->addAction(qaFavoriteRemove);
} else if (si) {
qmPopup->addAction(qaFavoriteAdd);
}
}

if (!si->qsUrl.isEmpty()) {
qmPopup->addAction(qaUrl);
}
}

if (! qmPopup->isEmpty()) {
qmPopup->addSeparator();
}

qmPopup->addMenu(qmFilters);

qmPopup->popup(qtwServers->viewport()->mapToGlobal(mpos), NULL);
@@ -387,6 +387,7 @@ Settings::Settings() {
// Special configuration options not exposed to UI
bDisableCELT = false;
disablePublicList = false;
disableConnectDialogEditing = false;

// Config updates
uiUpdateCounter = 0;
@@ -694,6 +695,7 @@ void Settings::load(QSettings* settings_ptr) {
// Special configuration options not exposed to UI
SAVELOAD(bDisableCELT, "audio/disablecelt");
SAVELOAD(disablePublicList, "ui/disablepubliclist");
SAVELOAD(disableConnectDialogEditing, "ui/disableconnectdialogediting");


// LCD
@@ -983,6 +985,7 @@ void Settings::save() {
// Special configuration options not exposed to UI
SAVELOAD(bDisableCELT, "audio/disablecelt");
SAVELOAD(disablePublicList, "ui/disablepubliclist");
SAVELOAD(disableConnectDialogEditing, "ui/disableconnectdialogediting");

// LCD
SAVELOAD(iLCDUserViewMinColWidth, "lcd/userview/mincolwidth");
@@ -313,6 +313,9 @@ struct Settings {
/// Disables the "Public Internet" section in the connect dialog if set.
bool disablePublicList;

/// Removes the add and edit options in the connect dialog if set.
bool disableConnectDialogEditing;

// Config updates
unsigned int uiUpdateCounter;

0 comments on commit 6a345f5

Please sign in to comment.
You can’t perform that action at this time.