|
|
74b83a |
--- kdenetwork-4.10.5/krdc/mainwindow.cpp.orig 2013-06-28 20:08:57.392483928 +0200
|
|
|
74b83a |
+++ kdenetwork-4.10.5/krdc/mainwindow.cpp 2013-10-29 09:41:07.000000000 +0100
|
|
|
74b83a |
@@ -340,8 +340,6 @@ void MainWindow::newConnection(const KUr
|
|
|
74b83a |
connect(view, SIGNAL(statusChanged(RemoteView::RemoteStatus)), this, SLOT(statusChanged(RemoteView::RemoteStatus)));
|
|
|
74b83a |
connect(view, SIGNAL(disconnected()), this, SLOT(disconnectHost()));
|
|
|
74b83a |
|
|
|
74b83a |
- m_remoteViewList.append(view);
|
|
|
74b83a |
-
|
|
|
74b83a |
QScrollArea *scrollArea = createScrollArea(m_tabWidget, view);
|
|
|
74b83a |
|
|
|
74b83a |
const int indexOfNewConnectionWidget = m_tabWidget->indexOf(m_newConnectionWidget);
|
|
|
74b83a |
@@ -350,6 +348,7 @@ void MainWindow::newConnection(const KUr
|
|
|
74b83a |
|
|
|
74b83a |
const int newIndex = m_tabWidget->addTab(scrollArea, KIcon("krdc"), tabName.isEmpty() ? url.prettyUrl(KUrl::RemoveTrailingSlash) : tabName);
|
|
|
74b83a |
m_tabWidget->setCurrentIndex(newIndex);
|
|
|
74b83a |
+ m_remoteViewMap.insert(m_tabWidget->widget(newIndex), view);
|
|
|
74b83a |
tabChanged(newIndex); // force to update m_currentRemoteView (tabChanged is not emitted when start page has been disabled)
|
|
|
74b83a |
|
|
|
74b83a |
view->start();
|
|
|
74b83a |
@@ -362,12 +361,13 @@ void MainWindow::openFromRemoteDesktopsM
|
|
|
74b83a |
if (!urlString.isEmpty()) {
|
|
|
74b83a |
const KUrl url(urlString);
|
|
|
74b83a |
// first check if url has already been opened; in case show the tab
|
|
|
74b83a |
- for (int i = 0; i < m_remoteViewList.count(); ++i) {
|
|
|
74b83a |
- if (m_remoteViewList.at(i)->url() == url) {
|
|
|
74b83a |
- m_tabWidget->setCurrentIndex(i);
|
|
|
74b83a |
+ foreach (QWidget *widget, m_remoteViewMap.keys()) {
|
|
|
74b83a |
+ if (m_remoteViewMap.value(widget)->url() == url) {
|
|
|
74b83a |
+ m_tabWidget->setCurrentWidget(widget);
|
|
|
74b83a |
return;
|
|
|
74b83a |
}
|
|
|
74b83a |
}
|
|
|
74b83a |
+
|
|
|
74b83a |
newConnection(url, false, nameString);
|
|
|
74b83a |
}
|
|
|
74b83a |
}
|
|
|
74b83a |
@@ -469,7 +469,7 @@ void MainWindow::statusChanged(RemoteVie
|
|
|
74b83a |
|
|
|
74b83a |
void MainWindow::takeScreenshot()
|
|
|
74b83a |
{
|
|
|
74b83a |
- const QPixmap snapshot = m_remoteViewList.at(m_currentRemoteView)->takeScreenshot();
|
|
|
74b83a |
+ const QPixmap snapshot = currentRemoteView()->takeScreenshot();
|
|
|
74b83a |
|
|
|
74b83a |
QApplication::clipboard()->setPixmap(snapshot);
|
|
|
74b83a |
}
|
|
|
74b83a |
@@ -491,8 +491,8 @@ void MainWindow::switchFullscreen()
|
|
|
74b83a |
restoreGeometry(m_mainWindowGeometry);
|
|
|
74b83a |
if (m_systemTrayIcon) m_systemTrayIcon->setAssociatedWidget(this);
|
|
|
74b83a |
|
|
|
74b83a |
- foreach(RemoteView *currentView, m_remoteViewList) {
|
|
|
74b83a |
- currentView->enableScaling(currentView->hostPreferences()->windowedScale());
|
|
|
74b83a |
+ foreach (RemoteView * view, m_remoteViewMap.values()) {
|
|
|
74b83a |
+ view->enableScaling(view->hostPreferences()->windowedScale());
|
|
|
74b83a |
}
|
|
|
74b83a |
|
|
|
74b83a |
if (m_toolBar) {
|
|
|
74b83a |
@@ -518,7 +518,7 @@ void MainWindow::switchFullscreen()
|
|
|
74b83a |
m_tabWidget->setTabBarHidden(true);
|
|
|
74b83a |
m_tabWidget->setDocumentMode(true);
|
|
|
74b83a |
|
|
|
74b83a |
- foreach(RemoteView *currentView, m_remoteViewList) {
|
|
|
74b83a |
+ foreach(RemoteView *currentView, m_remoteViewMap) {
|
|
|
74b83a |
currentView->enableScaling(currentView->hostPreferences()->fullscreenScale());
|
|
|
74b83a |
}
|
|
|
74b83a |
|
|
|
74b83a |
@@ -572,10 +572,11 @@ void MainWindow::disconnectHost()
|
|
|
74b83a |
QWidget *widgetToDelete;
|
|
|
74b83a |
if (view) {
|
|
|
74b83a |
widgetToDelete = (QWidget*) view->parent()->parent();
|
|
|
74b83a |
- m_remoteViewList.removeOne(view);
|
|
|
74b83a |
+ m_remoteViewMap.remove(m_remoteViewMap.key(view));
|
|
|
74b83a |
} else {
|
|
|
74b83a |
widgetToDelete = m_tabWidget->currentWidget();
|
|
|
74b83a |
- view = m_remoteViewList.takeAt(m_currentRemoteView);
|
|
|
74b83a |
+ view = currentRemoteView();
|
|
|
74b83a |
+ m_remoteViewMap.remove(m_remoteViewMap.key(view));
|
|
|
74b83a |
}
|
|
|
74b83a |
|
|
|
74b83a |
saveHostPrefs(view);
|
|
|
74b83a |
@@ -600,12 +601,10 @@ void MainWindow::disconnectHost()
|
|
|
74b83a |
void MainWindow::closeTab(QWidget *widget)
|
|
|
74b83a |
{
|
|
|
74b83a |
bool isNewConnectionPage = widget == m_newConnectionWidget;
|
|
|
74b83a |
- const int index = m_tabWidget->indexOf(widget);
|
|
|
74b83a |
-
|
|
|
74b83a |
- kDebug(5010) << index;
|
|
|
74b83a |
|
|
|
74b83a |
if (!isNewConnectionPage) {
|
|
|
74b83a |
- RemoteView *view = m_remoteViewList.takeAt(index);
|
|
|
74b83a |
+ RemoteView *view = m_remoteViewMap.value(widget);
|
|
|
74b83a |
+ m_remoteViewMap.remove(m_remoteViewMap.key(view));
|
|
|
74b83a |
view->startQuitting();
|
|
|
74b83a |
#ifdef TELEPATHY_SUPPORT
|
|
|
74b83a |
m_tubesManager->closeTube(view->url());
|
|
|
74b83a |
@@ -746,7 +745,7 @@ void MainWindow::showLocalCursor(bool sh
|
|
|
74b83a |
{
|
|
|
74b83a |
kDebug(5010) << showLocalCursor;
|
|
|
74b83a |
|
|
|
74b83a |
- RemoteView* view = m_remoteViewList.at(m_currentRemoteView);
|
|
|
74b83a |
+ RemoteView* view = currentRemoteView();
|
|
|
74b83a |
view->showDotCursor(showLocalCursor ? RemoteView::CursorOn : RemoteView::CursorOff);
|
|
|
74b83a |
view->hostPreferences()->setShowLocalCursor(showLocalCursor);
|
|
|
74b83a |
saveHostPrefs(view);
|
|
|
74b83a |
@@ -756,7 +755,7 @@ void MainWindow::viewOnly(bool viewOnly)
|
|
|
74b83a |
{
|
|
|
74b83a |
kDebug(5010) << viewOnly;
|
|
|
74b83a |
|
|
|
74b83a |
- RemoteView* view = m_remoteViewList.at(m_currentRemoteView);
|
|
|
74b83a |
+ RemoteView* view = currentRemoteView();
|
|
|
74b83a |
view->setViewOnly(viewOnly);
|
|
|
74b83a |
view->hostPreferences()->setViewOnly(viewOnly);
|
|
|
74b83a |
saveHostPrefs(view);
|
|
|
74b83a |
@@ -766,7 +765,7 @@ void MainWindow::grabAllKeys(bool grabAl
|
|
|
74b83a |
{
|
|
|
74b83a |
kDebug(5010);
|
|
|
74b83a |
|
|
|
74b83a |
- RemoteView* view = m_remoteViewList.at(m_currentRemoteView);
|
|
|
74b83a |
+ RemoteView* view = currentRemoteView();
|
|
|
74b83a |
view->setGrabAllKeys(grabAllKeys);
|
|
|
74b83a |
view->hostPreferences()->setGrabAllKeys(grabAllKeys);
|
|
|
74b83a |
saveHostPrefs(view);
|
|
|
74b83a |
@@ -776,7 +775,7 @@ void MainWindow::scale(bool scale)
|
|
|
74b83a |
{
|
|
|
74b83a |
kDebug(5010);
|
|
|
74b83a |
|
|
|
74b83a |
- RemoteView* view = m_remoteViewList.at(m_currentRemoteView);
|
|
|
74b83a |
+ RemoteView* view = currentRemoteView();
|
|
|
74b83a |
view->enableScaling(scale);
|
|
|
74b83a |
if (m_fullscreenWindow)
|
|
|
74b83a |
view->hostPreferences()->setFullscreenScale(scale);
|
|
|
74b83a |
@@ -854,7 +853,7 @@ void MainWindow::updateActionStatus()
|
|
|
74b83a |
if (m_tabWidget->currentWidget() == m_newConnectionWidget)
|
|
|
74b83a |
enabled = false;
|
|
|
74b83a |
|
|
|
74b83a |
- RemoteView* view = (m_currentRemoteView >= 0 && enabled) ? m_remoteViewList.at(m_currentRemoteView) : 0;
|
|
|
74b83a |
+ RemoteView* view = (m_currentRemoteView >= 0 && enabled) ? currentRemoteView() : 0;
|
|
|
74b83a |
|
|
|
74b83a |
actionCollection()->action("take_screenshot")->setEnabled(enabled);
|
|
|
74b83a |
actionCollection()->action("disconnect")->setEnabled(enabled);
|
|
|
74b83a |
@@ -934,15 +933,15 @@ void MainWindow::updateConfiguration()
|
|
|
74b83a |
}
|
|
|
74b83a |
|
|
|
74b83a |
// Send update configuration message to all views
|
|
|
74b83a |
- for (int i = 0; i < m_remoteViewList.count(); ++i) {
|
|
|
74b83a |
- m_remoteViewList.at(i)->updateConfiguration();
|
|
|
74b83a |
+ foreach (RemoteView *view, m_remoteViewMap.values()) {
|
|
|
74b83a |
+ view->updateConfiguration();
|
|
|
74b83a |
}
|
|
|
74b83a |
|
|
|
74b83a |
}
|
|
|
74b83a |
|
|
|
74b83a |
void MainWindow::quit(bool systemEvent)
|
|
|
74b83a |
{
|
|
|
74b83a |
- const bool haveRemoteConnections = !m_remoteViewList.isEmpty();
|
|
|
74b83a |
+ const bool haveRemoteConnections = !m_remoteViewMap.isEmpty();
|
|
|
74b83a |
if (systemEvent || !haveRemoteConnections || KMessageBox::warningContinueCancel(this,
|
|
|
74b83a |
i18n("Are you sure you want to quit the KDE Remote Desktop Client?"),
|
|
|
74b83a |
i18n("Confirm Quit"),
|
|
|
74b83a |
@@ -951,17 +950,17 @@ void MainWindow::quit(bool systemEvent)
|
|
|
74b83a |
|
|
|
74b83a |
if (Settings::rememberSessions()) { // remember open remote views for next startup
|
|
|
74b83a |
QStringList list;
|
|
|
74b83a |
- for (int i = 0; i < m_remoteViewList.count(); ++i) {
|
|
|
74b83a |
- kDebug(5010) << m_remoteViewList.at(i)->url();
|
|
|
74b83a |
- list.append(m_remoteViewList.at(i)->url().prettyUrl(KUrl::RemoveTrailingSlash));
|
|
|
74b83a |
+ foreach (RemoteView *view, m_remoteViewMap.values()) {
|
|
|
74b83a |
+ kDebug(5010) << view->url();
|
|
|
74b83a |
+ list.append(view->url().prettyUrl(KUrl::RemoveTrailingSlash));
|
|
|
74b83a |
}
|
|
|
74b83a |
Settings::setOpenSessions(list);
|
|
|
74b83a |
}
|
|
|
74b83a |
|
|
|
74b83a |
saveHostPrefs();
|
|
|
74b83a |
|
|
|
74b83a |
- for (int i = 0; i < m_remoteViewList.count(); ++i) {
|
|
|
74b83a |
- m_remoteViewList.at(i)->startQuitting();
|
|
|
74b83a |
+ foreach (RemoteView *view, m_remoteViewMap.values()) {
|
|
|
74b83a |
+ view->startQuitting();
|
|
|
74b83a |
}
|
|
|
74b83a |
|
|
|
74b83a |
Settings::self()->writeConfig();
|
|
|
74b83a |
@@ -1029,9 +1028,9 @@ void MainWindow::saveProperties(KConfigG
|
|
|
74b83a |
|
|
|
74b83a |
void MainWindow::saveHostPrefs()
|
|
|
74b83a |
{
|
|
|
74b83a |
- for (int i = 0; i < m_remoteViewList.count(); ++i) {
|
|
|
74b83a |
- saveHostPrefs(m_remoteViewList.at(i));
|
|
|
74b83a |
- m_remoteViewList.at(i)->startQuitting();
|
|
|
74b83a |
+ foreach (RemoteView *view, m_remoteViewMap.values()) {
|
|
|
74b83a |
+ saveHostPrefs(view);
|
|
|
74b83a |
+ view->startQuitting();
|
|
|
74b83a |
}
|
|
|
74b83a |
}
|
|
|
74b83a |
|
|
|
74b83a |
@@ -1172,9 +1171,9 @@ void MainWindow::newConnectionPage(bool
|
|
|
74b83a |
m_addressInput->setFocus();
|
|
|
74b83a |
}
|
|
|
74b83a |
|
|
|
74b83a |
-QList<RemoteView *> MainWindow::remoteViewList() const
|
|
|
74b83a |
+QMap<QWidget *, RemoteView *> MainWindow::remoteViewList() const
|
|
|
74b83a |
{
|
|
|
74b83a |
- return m_remoteViewList;
|
|
|
74b83a |
+ return m_remoteViewMap;
|
|
|
74b83a |
}
|
|
|
74b83a |
|
|
|
74b83a |
QList<RemoteViewFactory *> MainWindow::remoteViewFactoriesList() const
|
|
|
74b83a |
@@ -1182,9 +1181,13 @@ QList<RemoteViewFactory *> MainWindow::r
|
|
|
74b83a |
return m_remoteViewFactories.values();
|
|
|
74b83a |
}
|
|
|
74b83a |
|
|
|
74b83a |
-int MainWindow::currentRemoteView() const
|
|
|
74b83a |
+RemoteView* MainWindow::currentRemoteView() const
|
|
|
74b83a |
{
|
|
|
74b83a |
- return m_currentRemoteView;
|
|
|
74b83a |
+ if (m_currentRemoteView >= 0) {
|
|
|
74b83a |
+ return m_remoteViewMap.value(m_tabWidget->widget(m_currentRemoteView));
|
|
|
74b83a |
+ } else {
|
|
|
74b83a |
+ return 0;
|
|
|
74b83a |
+ }
|
|
|
74b83a |
}
|
|
|
74b83a |
|
|
|
74b83a |
void MainWindow::createDockWidget()
|
|
|
74b83a |
--- kdenetwork-4.10.5/krdc/mainwindow.h.orig 2013-06-28 20:08:57.392483928 +0200
|
|
|
74b83a |
+++ kdenetwork-4.10.5/krdc/mainwindow.h 2013-10-29 09:41:07.000000000 +0100
|
|
|
74b83a |
@@ -60,9 +60,9 @@ public:
|
|
|
74b83a |
MainWindow(QWidget *parent = 0);
|
|
|
74b83a |
~MainWindow();
|
|
|
74b83a |
|
|
|
74b83a |
- QList<RemoteView *> remoteViewList() const;
|
|
|
74b83a |
+ QMap<QWidget *, RemoteView *> remoteViewList() const;
|
|
|
74b83a |
QList<RemoteViewFactory *> remoteViewFactoriesList() const;
|
|
|
74b83a |
- int currentRemoteView() const;
|
|
|
74b83a |
+ RemoteView* currentRemoteView() const;
|
|
|
74b83a |
|
|
|
74b83a |
public slots:
|
|
|
74b83a |
void newConnection(const KUrl &newUrl = KUrl(), bool switchFullscreenWhenConnected = false, const QString &tabName = QString());
|
|
|
74b83a |
@@ -125,7 +125,7 @@ private:
|
|
|
74b83a |
|
|
|
74b83a |
BookmarkManager *m_bookmarkManager;
|
|
|
74b83a |
|
|
|
74b83a |
- QList<RemoteView *> m_remoteViewList;
|
|
|
74b83a |
+ QMap<QWidget *, RemoteView *> m_remoteViewMap;
|
|
|
74b83a |
QMap<int, RemoteViewFactory *> m_remoteViewFactories;
|
|
|
74b83a |
|
|
|
74b83a |
int m_currentRemoteView;
|
|
|
74b83a |
--- kdenetwork-4.10.5/krdc/bookmarkmanager.cpp.orig 2013-06-28 20:08:57.370483046 +0200
|
|
|
74b83a |
+++ kdenetwork-4.10.5/krdc/bookmarkmanager.cpp 2013-10-29 09:41:07.000000000 +0100
|
|
|
74b83a |
@@ -114,8 +114,9 @@ bool BookmarkManager::editBookmarkEntry(
|
|
|
74b83a |
|
|
|
74b83a |
QString BookmarkManager::currentUrl() const
|
|
|
74b83a |
{
|
|
|
74b83a |
- if (m_mainWindow->currentRemoteView() >= 0)
|
|
|
74b83a |
- return urlForView(m_mainWindow->remoteViewList().at(m_mainWindow->currentRemoteView()));
|
|
|
74b83a |
+ RemoteView *view = m_mainWindow->currentRemoteView();
|
|
|
74b83a |
+ if (view)
|
|
|
74b83a |
+ return urlForView(view);
|
|
|
74b83a |
else
|
|
|
74b83a |
return QString();
|
|
|
74b83a |
}
|
|
|
74b83a |
@@ -146,10 +147,10 @@ QList<QPair<QString, QString> > Bookmark
|
|
|
74b83a |
{
|
|
|
74b83a |
QList<QPair<QString, QString> > list;
|
|
|
74b83a |
|
|
|
74b83a |
- QListIterator<RemoteView *> iter(m_mainWindow->remoteViewList());
|
|
|
74b83a |
+ QMapIterator<QWidget *, RemoteView *> iter(m_mainWindow->remoteViewList());
|
|
|
74b83a |
|
|
|
74b83a |
while (iter.hasNext()) {
|
|
|
74b83a |
- RemoteView *next = iter.next();
|
|
|
74b83a |
+ RemoteView *next = iter.next().value();
|
|
|
74b83a |
const QString url = next->url().prettyUrl(KUrl::RemoveTrailingSlash);
|
|
|
74b83a |
list << QPair<QString, QString>(url, url);
|
|
|
74b83a |
}
|