1 /****************************************************************************
3 ** Copyright (C) 2007 Urs Wolfer <uwolfer @ kde.org>
5 ** This file is part of KDE.
7 ** This program is free software; you can redistribute it and/or modify
8 ** it under the terms of the GNU General Public License as published by
9 ** the Free Software Foundation; either version 2 of the License, or
10 ** (at your option) any later version.
12 ** This program is distributed in the hope that it will be useful,
13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ** GNU General Public License for more details.
17 ** You should have received a copy of the GNU General Public License
18 ** along with this program; see the file COPYING. If not, write to
19 ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 ** Boston, MA 02110-1301, USA.
22 ****************************************************************************/
27 #include "remoteview.h"
29 #include <KXmlGuiWindow>
35 class BookmarkManager
;
36 class FloatingToolBar
;
44 class MainWindow
: public KXmlGuiWindow
48 MainWindow(QWidget
*parent
= 0);
51 QList
<RemoteView
*> remoteViewList() const;
52 int currentRemoteView() const;
55 void newConnection(const KUrl
&newUrl
= KUrl(), bool switchFullscreenWhenConnected
= false);
58 virtual void closeEvent(QCloseEvent
*event
);
61 void restoreOpenSessions();
64 void configureNotifications();
66 void configureToolbars();
68 void resizeTabWidget(int w
, int h
);
69 void statusChanged(RemoteView::RemoteStatus status
);
70 void showRemoteViewToolbar();
71 void takeScreenshot();
72 void switchFullscreen();
74 void viewOnly(bool viewOnly
);
75 void showLocalCursor(bool showLocalCursor
);
76 void grabAllKeys(bool grabAllKeys
);
77 void scale(bool scale
);
78 void updateActionStatus();
79 void updateConfiguration();
80 void tabChanged(int index
);
81 void createStartPage();
82 void newVncConnection();
83 void newNxConnection();
84 void newRdpConnection();
85 void createZeroconfPage();
86 void closeZeroconfPage();
87 void openFromDockWidget(const QModelIndex
&index
);
91 QScrollArea
*createScrollArea(QWidget
*parent
, RemoteView
*remoteView
);
93 QWidget
*m_fullscreenWindow
;
94 QByteArray m_mainWindowGeometry
;
96 KToggleAction
*m_menubarAction
;
97 KTabWidget
*m_tabWidget
;
98 KUrlNavigator
*m_addressNavigator
;
100 FloatingToolBar
*m_toolBar
;
102 BookmarkManager
*m_bookmarkManager
;
104 QList
<RemoteView
*> m_remoteViewList
;
106 int m_topBottomBorder
; // tabwidget borders
107 int m_leftRightBorder
;
109 int m_currentRemoteView
;
110 bool m_showStartPage
;
111 bool m_switchFullscreenWhenConnected
;
113 SystemTrayIcon
*m_systemTrayIcon
;
114 ZeroconfPage
*m_zeroconfPage
;
117 #include <QApplication>
118 #include <QDesktopWidget>
119 #include <QMouseEvent>
121 class MinimizePixel
: public QWidget
125 MinimizePixel(QWidget
*parent
)
128 move(QApplication::desktop()->screenGeometry().width() - 1, 0);
135 void mousePressEvent(QMouseEvent
*event
) {
136 if (event
->button() == Qt::RightButton
)
141 #include <QScrollArea>
143 class RemoteViewScrollArea
: public QScrollArea
147 RemoteViewScrollArea(QWidget
*parent
)
148 : QScrollArea(parent
) {
152 void resized(int w
, int h
);
155 void resizeEvent(QResizeEvent
*event
) {
156 QScrollArea::resizeEvent(event
);
157 emit
resized(width() - 2*frameWidth(), height() - 2*frameWidth());