Rename 'Logout' to 'Disconnect' since this is what actually is done with this action.
[kdenetwork.git] / krdc / mainwindow.h
blob8bc28964df0b0ba8309b03f75a099619697dde8d
1 /****************************************************************************
2 **
3 ** Copyright (C) 2007 Urs Wolfer <uwolfer @ kde.org>
4 **
5 ** This file is part of KDE.
6 **
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 ****************************************************************************/
24 #ifndef MAINWINDOW_H
25 #define MAINWINDOW_H
27 #include "remoteview.h"
29 #include <KXmlGuiWindow>
31 class KToggleAction;
32 class KTabWidget;
33 class KUrlNavigator;
35 class BookmarkManager;
36 class FloatingToolBar;
37 class RemoteView;
38 class SystemTrayIcon;
39 class ZeroconfPage;
41 class QScrollArea;
42 class QModelIndex;
44 class MainWindow : public KXmlGuiWindow
46 Q_OBJECT
47 public:
48 MainWindow(QWidget *parent = 0);
49 ~MainWindow();
51 QList<RemoteView *> remoteViewList() const;
52 int currentRemoteView() const;
54 public slots:
55 void newConnection(const KUrl &newUrl = KUrl(), bool switchFullscreenWhenConnected = false);
57 protected:
58 virtual void closeEvent(QCloseEvent *event);
60 private slots:
61 void restoreOpenSessions();
62 void quit();
63 void preferences();
64 void configureNotifications();
65 void configureKeys();
66 void configureToolbars();
67 void showMenubar();
68 void resizeTabWidget(int w, int h);
69 void statusChanged(RemoteView::RemoteStatus status);
70 void showRemoteViewToolbar();
71 void takeScreenshot();
72 void switchFullscreen();
73 void disconnect();
74 void closeTab(QWidget *widget);
75 void viewOnly(bool viewOnly);
76 void showLocalCursor(bool showLocalCursor);
77 void grabAllKeys(bool grabAllKeys);
78 void scale(bool scale);
79 void updateActionStatus();
80 void updateConfiguration();
81 void tabChanged(int index);
82 void createStartPage();
83 void newVncConnection();
84 void newNxConnection();
85 void newRdpConnection();
86 void createZeroconfPage();
87 void closeZeroconfPage();
88 void openFromDockWidget(const QModelIndex &index);
90 private:
91 void setupActions();
92 QScrollArea *createScrollArea(QWidget *parent, RemoteView *remoteView);
94 QWidget *m_fullscreenWindow;
95 QByteArray m_mainWindowGeometry;
97 KToggleAction *m_menubarAction;
98 KTabWidget *m_tabWidget;
99 KUrlNavigator *m_addressNavigator;
101 FloatingToolBar *m_toolBar;
103 BookmarkManager *m_bookmarkManager;
105 QList<RemoteView *> m_remoteViewList;
107 int m_topBottomBorder; // tabwidget borders
108 int m_leftRightBorder;
110 int m_currentRemoteView;
111 bool m_showStartPage;
112 bool m_switchFullscreenWhenConnected;
114 SystemTrayIcon *m_systemTrayIcon;
115 ZeroconfPage *m_zeroconfPage;
118 #include <QApplication>
119 #include <QDesktopWidget>
120 #include <QMouseEvent>
122 class MinimizePixel : public QWidget
124 Q_OBJECT
125 public:
126 MinimizePixel(QWidget *parent)
127 : QWidget(parent) {
128 setFixedSize(1, 1);
129 move(QApplication::desktop()->screenGeometry().width() - 1, 0);
132 signals:
133 void rightClicked();
135 protected:
136 void mousePressEvent(QMouseEvent *event) {
137 if (event->button() == Qt::RightButton)
138 emit rightClicked();
142 #include <QScrollArea>
144 class RemoteViewScrollArea : public QScrollArea
146 Q_OBJECT
147 public:
148 RemoteViewScrollArea(QWidget *parent)
149 : QScrollArea(parent) {
152 signals:
153 void resized(int w, int h);
155 protected:
156 void resizeEvent(QResizeEvent *event) {
157 QScrollArea::resizeEvent(event);
158 emit resized(width() - 2*frameWidth(), height() - 2*frameWidth());
162 #endif