Commit 0f217bbf authored by Jonathan Esk-Riddell's avatar Jonathan Esk-Riddell 🏄
Browse files

REVIEW:129142

Fix cancel button on connection setup dialog
When selecting a pre-existing URL show it in the connect field for easy use/editing
by Edo iotaka <net.monitor.x@gmail.com>
parent af24d8d4
......@@ -299,7 +299,8 @@ void MainWindow::newConnection(const QUrl &newUrl, bool switchFullscreenWhenConn
// Configure the view
HostPreferences* prefs = view->hostPreferences();
prefs->showDialogIfNeeded(this);
// if the user press cancel
if (! prefs->showDialogIfNeeded(this)) return;
view->showDotCursor(prefs->showLocalCursor() ? RemoteView::CursorOn : RemoteView::CursorOff);
view->setViewOnly(prefs->viewOnly());
......@@ -342,6 +343,18 @@ void MainWindow::openFromRemoteDesktopsModel(const QModelIndex &index)
}
}
void MainWindow::selectFromRemoteDesktopsModel(const QModelIndex &index)
{
const QString urlString = index.data(10001).toString();
if (!urlString.isEmpty() && m_protocolInput && m_addressInput) {
const QUrl url(urlString);
m_addressInput->setText(url.authority());
int index = m_protocolInput->findText(url.scheme());
if (index>=0) m_protocolInput->setCurrentIndex(index);
}
}
void MainWindow::resizeTabWidget(int w, int h)
{
qCDebug(KRDC) << "tabwidget resize, view size: w: " << w << ", h: " << h;
......@@ -1098,6 +1111,9 @@ QWidget* MainWindow::newConnectionWidget()
SLOT(saveConnectionListSort(int,Qt::SortOrder)));
connect(m_newConnectionTableView, SIGNAL(doubleClicked(QModelIndex)),
SLOT(openFromRemoteDesktopsModel(QModelIndex)));
// useful to edit similar address
connect(m_newConnectionTableView, SIGNAL(clicked(QModelIndex)),
SLOT(selectFromRemoteDesktopsModel(QModelIndex)));
m_newConnectionTableView->setContextMenuPolicy(Qt::CustomContextMenu);
connect(m_newConnectionTableView, SIGNAL(customContextMenuRequested(QPoint)), SLOT(showConnectionContextMenu(QPoint)));
......
......@@ -98,6 +98,7 @@ private Q_SLOTS:
QWidget* newConnectionWidget();
void newConnectionPage(bool clearInput = true);
void openFromRemoteDesktopsModel(const QModelIndex &index);
void selectFromRemoteDesktopsModel(const QModelIndex &index);
void createDockWidget();
void showConnectionContextMenu(const QPoint &pos);
void saveConnectionListSort(const int logicalindex, const Qt::SortOrder order);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment