2
* Copyright (C) 2010 Marco Martin <notmart@gmail.com>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU Library General Public License as
6
* published by the Free Software Foundation; either version 2, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details
14
* You should have received a copy of the GNU Library General Public
15
* License along with this program; if not, write to the
16
* Free Software Foundation, Inc.,
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
#include "netdialogmanager.h"
22
#include <QtGui/QWidget>
23
#include <QtGui/QStyleOptionGraphicsItem>
24
#include <QtGui/QGraphicsProxyWidget>
25
#include <QtGui/QPainter>
26
#include <QtGui/QApplication>
28
#include <KWindowSystem>
30
#include <Plasma/Applet>
31
#include <Plasma/Containment>
32
#include <Plasma/Corona>
33
#include <Plasma/WindowEffects>
35
NetDialogManager::NetDialogManager(Plasma::Corona *parent)
36
: Plasma::AbstractDialogManager(parent),
41
NetDialogManager::~NetDialogManager()
45
void NetDialogManager::showDialog(QWidget *widget, Plasma::Applet *applet)
48
if (KWindowSystem::compositingActive()) {
49
widget->setAttribute(Qt::WA_WindowPropagation, false);
50
widget->setAttribute(Qt::WA_TranslucentBackground);
51
widget->setAttribute(Qt::WA_NoSystemBackground, false);
52
widget->setWindowFlags(Qt::FramelessWindowHint);
53
KWindowSystem::setState(widget->effectiveWinId(), NET::MaxVert|NET::MaxHoriz);
54
Plasma::WindowEffects::enableBlurBehind(widget->effectiveWinId(), true);
56
QPalette palette = widget->palette();
57
palette.setColor(QPalette::Window, QColor(0,0,0,100));
58
widget->setAttribute(Qt::WA_WindowPropagation);
59
palette.setColor(QPalette::WindowText, Qt::white);
60
palette.setColor(QPalette::ToolTipText, Qt::white);
61
widget->setPalette(palette);
64
Plasma::Containment *containment = applet->containment();
66
Plasma::Corona *corona = containment->corona();
68
QRect r = corona->availableScreenRegion(containment->screen()).boundingRect();
69
//assumption: the panel is 100% wide
70
QRect screenRect = corona->screenGeometry(containment->screen());
72
widget->setContentsMargins(r.left() - screenRect.left(),
73
r.top() - screenRect.top(),
74
screenRect.right() - r.right(),
75
screenRect.bottom() - r.bottom());
83
#include "netdialogmanager.moc"