summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Riddell <jr@jriddell.org>2016-10-26 13:18:57 (GMT)
committerJonathan Riddell <jr@jriddell.org>2016-10-26 13:18:57 (GMT)
commit0f217bbf339b9d1d0efa30a84faf41ca7097b533 (patch)
treec448aa1bfebce57508d8116e84f39d809dbf6fde
parentaf24d8d45ce74c299bd13bd1b881bc967f8f482f (diff)
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>
-rw-r--r--mainwindow.cpp18
-rw-r--r--mainwindow.h1
2 files changed, 18 insertions, 1 deletions
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 20f329a..ebcba2d 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -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)));
diff --git a/mainwindow.h b/mainwindow.h
index 2c66eed..55b64ac 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -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);