mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
kcontrol: convert randr KCM initialization to autostart
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
f511ecd2b8
commit
f0232f48b2
6 changed files with 82 additions and 33 deletions
9
kcontrol/krdb/krdb.desktop
Normal file
9
kcontrol/krdb/krdb.desktop
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
[Desktop Entry]
|
||||||
|
Type=Service
|
||||||
|
Name=KDE Resource Database Utility
|
||||||
|
Exec=krdb
|
||||||
|
Icon=preferences-desktop-theme-style
|
||||||
|
StartupNotify=false
|
||||||
|
OnlyShowIn=KDE;
|
||||||
|
X-KDE-autostart-phase=1
|
||||||
|
X-DocPath=kcontrol/kcmstyle/index.html
|
|
@ -5,7 +5,6 @@ include_directories(${X11_Xrandr_INCLUDE_PATH})
|
||||||
|
|
||||||
########### next target ###############
|
########### next target ###############
|
||||||
|
|
||||||
|
|
||||||
set(randrinternal_PART_SRCS
|
set(randrinternal_PART_SRCS
|
||||||
randr.cpp
|
randr.cpp
|
||||||
randrdisplay.cpp
|
randrdisplay.cpp
|
||||||
|
@ -40,10 +39,25 @@ install(
|
||||||
DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}
|
DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
########### next target ###############
|
|
||||||
|
|
||||||
install(
|
install(
|
||||||
FILES randr.desktop
|
FILES randr.desktop
|
||||||
DESTINATION ${KDE4_SERVICES_INSTALL_DIR}
|
DESTINATION ${KDE4_SERVICES_INSTALL_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
########### next target ###############
|
||||||
|
|
||||||
|
add_executable(krandr krandr.cpp)
|
||||||
|
target_link_libraries(krandr
|
||||||
|
KDE4::kdecore
|
||||||
|
${X11_X11_LIB}
|
||||||
|
)
|
||||||
|
|
||||||
|
install(
|
||||||
|
TARGETS krandr
|
||||||
|
DESTINATION ${KDE4_BIN_INSTALL_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
install(
|
||||||
|
FILES krandr.desktop
|
||||||
|
DESTINATION ${KDE4_AUTOSTART_INSTALL_DIR}
|
||||||
|
)
|
||||||
|
|
46
kcontrol/randr/krandr.cpp
Normal file
46
kcontrol/randr/krandr.cpp
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2007 Gustavo Pichorim Boiko <gustavo.boiko@kdemail.net>
|
||||||
|
* Copyright (c) 2002,2003 Hamish Rodda <rodda@kde.org>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <KConfig>
|
||||||
|
#include <KConfigGroup>
|
||||||
|
#include <KProcess>
|
||||||
|
#include <KDebug>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
// application instance for events processing
|
||||||
|
QCoreApplication app(argc, argv);
|
||||||
|
|
||||||
|
KConfig config("krandrrc");
|
||||||
|
KConfigGroup group = config.group("Display");
|
||||||
|
const bool applyonstartup = group.readEntry("ApplyOnStartup", false);
|
||||||
|
if (applyonstartup) {
|
||||||
|
const QStringList commands = group.readEntry("StartupCommands").split("\n");
|
||||||
|
foreach (const QString &command, commands) {
|
||||||
|
KProcess kproc;
|
||||||
|
kproc.setShellCommand(command);
|
||||||
|
kproc.start();
|
||||||
|
if (!kproc.waitForStarted() || !kproc.waitForFinished()) {
|
||||||
|
kWarning() << kproc.readAllStandardError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
8
kcontrol/randr/krandr.desktop
Normal file
8
kcontrol/randr/krandr.desktop
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
[Desktop Entry]
|
||||||
|
Type=Service
|
||||||
|
Name=KDE Display Size & Orientation
|
||||||
|
Exec=krandr
|
||||||
|
Icon=preferences-desktop-display-randr
|
||||||
|
StartupNotify=false
|
||||||
|
OnlyShowIn=KDE;
|
||||||
|
X-KDE-autostart-phase=0
|
|
@ -24,39 +24,15 @@
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <KPluginFactory>
|
#include <KPluginFactory>
|
||||||
#include <KPluginLoader>
|
#include <KPluginLoader>
|
||||||
#include <KDebug>
|
|
||||||
#include <KApplication>
|
#include <KApplication>
|
||||||
#include <KProcess>
|
#include <KDebug>
|
||||||
#include <kdemacros.h>
|
|
||||||
#include <config-X11.h>
|
#include <config-X11.h>
|
||||||
|
|
||||||
#include "randr.h"
|
#include "randr.h"
|
||||||
|
|
||||||
// DLL Interface for kcontrol
|
|
||||||
K_PLUGIN_FACTORY(KSSFactory, registerPlugin<KRandRModule>();)
|
K_PLUGIN_FACTORY(KSSFactory, registerPlugin<KRandRModule>();)
|
||||||
K_EXPORT_PLUGIN(KSSFactory("krandr"))
|
K_EXPORT_PLUGIN(KSSFactory("krandr"))
|
||||||
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
KDE_EXPORT void kcminit_randr()
|
|
||||||
{
|
|
||||||
KConfig config("krandrrc");
|
|
||||||
KConfigGroup group = config.group("Display");
|
|
||||||
const bool applyonstartup = group.readEntry("ApplyOnStartup", false);
|
|
||||||
if (applyonstartup) {
|
|
||||||
const QStringList commands = group.readEntry("StartupCommands").split("\n");
|
|
||||||
foreach (const QString &command, commands) {
|
|
||||||
KProcess kproc;
|
|
||||||
kproc.setShellCommand(command);
|
|
||||||
kproc.start();
|
|
||||||
if (!kproc.waitForStarted() || !kproc.waitForFinished()) {
|
|
||||||
kWarning() << kproc.readAllStandardError();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
KRandRModule::KRandRModule(QWidget *parent, const QVariantList&)
|
KRandRModule::KRandRModule(QWidget *parent, const QVariantList&)
|
||||||
: KCModule(KSSFactory::componentData(), parent)
|
: KCModule(KSSFactory::componentData(), parent)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,13 +2,9 @@
|
||||||
Exec=kcmshell4 randr
|
Exec=kcmshell4 randr
|
||||||
Icon=preferences-desktop-display-randr
|
Icon=preferences-desktop-display-randr
|
||||||
Type=Service
|
Type=Service
|
||||||
X-KDE-ServiceTypes=KCModule,KCModuleInit
|
X-KDE-ServiceTypes=KCModule
|
||||||
X-KDE-Library=kcm_randr
|
X-KDE-Library=kcm_randr
|
||||||
X-KDE-Init-Symbol=kcminit_randr
|
|
||||||
X-KDE-Init-Phase=0
|
|
||||||
X-KDE-ParentApp=kcontrol
|
X-KDE-ParentApp=kcontrol
|
||||||
#This is always false when kbuildsycoca runs, probably because it is now a QCoreApplication
|
|
||||||
#Hidden[$e]=$(if xdpyinfo|grep RANDR > /dev/null; then echo "false"; else echo "true"; fi)
|
|
||||||
|
|
||||||
X-KDE-System-Settings-Parent-Category=display
|
X-KDE-System-Settings-Parent-Category=display
|
||||||
X-KDE-Weight=50
|
X-KDE-Weight=50
|
||||||
|
|
Loading…
Add table
Reference in a new issue