• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

Plasma

savercorona.cpp

Go to the documentation of this file.
00001 /*
00002  *   Copyright 2008 Aaron Seigo <aseigo@kde.org>
00003  *
00004  *   This program is free software; you can redistribute it and/or modify
00005  *   it under the terms of the GNU Library General Public License as
00006  *   published by the Free Software Foundation; either version 2, or
00007  *   (at your option) any later version.
00008  *
00009  *   This program is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *   GNU General Public License for more details
00013  *
00014  *   You should have received a copy of the GNU Library General Public
00015  *   License along with this program; if not, write to the
00016  *   Free Software Foundation, Inc.,
00017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00018  */
00019 
00020 #include "savercorona.h"
00021 
00022 #include <QApplication>
00023 #include <QDesktopWidget>
00024 #include <QGraphicsLayout>
00025 
00026 #include <KDebug>
00027 #include <KDialog>
00028 #include <KStandardDirs>
00029 
00030 #include <Plasma/Containment>
00031 
00032 SaverCorona::SaverCorona(QObject *parent)
00033     : Plasma::Corona(parent)
00034 {
00035     init();
00036 }
00037 
00038 void SaverCorona::init()
00039 {
00040     QDesktopWidget *desktop = QApplication::desktop();
00041     m_numScreens = desktop->numScreens();
00042     if (m_numScreens > 1) {
00043         kDebug() << "maybe someone should implement multiple screen support";
00044     }
00045 }
00046 
00047 void SaverCorona::loadDefaultLayout()
00048 {
00049     kDebug();
00050     QString defaultConfig = KStandardDirs::locate("appdata", "plasma-overlay-default-layoutrc");
00051     if (!defaultConfig.isEmpty()) {
00052         kDebug() << "attempting to load the default layout from:" << defaultConfig;
00053         loadLayout(defaultConfig);
00054         return;
00055     }
00056 
00057     QDesktopWidget *desktop = QApplication::desktop();
00058 
00059     // create a containment for the screen
00060     QRect g = desktop->screenGeometry(0);
00061     kDebug() << "     screen geometry is" << g;
00062     Plasma::Containment *c = addContainment("saverdesktop");
00063     c->setScreen(0);
00064     c->setFormFactor(Plasma::Planar);
00065     c->flushPendingConstraintsEvents();
00066 
00067     // a default clock
00068     Plasma::Applet *clock =  Plasma::Applet::load("clock", c->id() + 1);
00069     c->addApplet(clock, QPointF(KDialog::spacingHint(), KDialog::spacingHint()), true);
00070     clock->init();
00071     clock->flushPendingConstraintsEvents();
00072 
00073     emit containmentAdded(c);
00074 
00075 }
00076 
00077 int SaverCorona::numScreens() const
00078 {
00079     return QApplication::desktop()->numScreens();
00080 }
00081 
00082 QRect SaverCorona::screenGeometry(int id) const
00083 {
00084     return QApplication::desktop()->screenGeometry(id);
00085 }
00086 
00087 #include "savercorona.moc"
00088 

Plasma

Skip menu "Plasma"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal