mirror of
https://bitbucket.org/smil3y/kde-playground.git
synced 2025-02-24 02:42:51 +00:00
kgreeter: implement test option
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
cdc2a6834e
commit
e5a5cbdba5
4 changed files with 148 additions and 12 deletions
|
@ -27,14 +27,15 @@ set_package_properties(GLIB2 PROPERTIES
|
||||||
TYPE REQUIRED
|
TYPE REQUIRED
|
||||||
)
|
)
|
||||||
|
|
||||||
add_subdirectory(kcm)
|
|
||||||
|
|
||||||
configure_file(
|
configure_file(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/config-kgreeter.h.cmake
|
${CMAKE_CURRENT_SOURCE_DIR}/config-kgreeter.h.cmake
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/config-kgreeter.h
|
${CMAKE_CURRENT_BINARY_DIR}/config-kgreeter.h
|
||||||
@ONLY
|
@ONLY
|
||||||
)
|
)
|
||||||
|
|
||||||
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
add_subdirectory(kcm)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
${KATIE_INCLUDES}
|
${KATIE_INCLUDES}
|
||||||
${KDE4_INCLUDES}
|
${KDE4_INCLUDES}
|
||||||
|
|
|
@ -18,14 +18,18 @@
|
||||||
|
|
||||||
#include "kgreeterconfig.h"
|
#include "kgreeterconfig.h"
|
||||||
|
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QProcess>
|
||||||
#include <kdebug.h>
|
#include <kdebug.h>
|
||||||
#include <klocale.h>
|
#include <klocale.h>
|
||||||
|
#include <kstandarddirs.h>
|
||||||
|
#include <kmessagebox.h>
|
||||||
#include <kaboutdata.h>
|
#include <kaboutdata.h>
|
||||||
#include <kconfig.h>
|
|
||||||
#include <kconfiggroup.h>
|
|
||||||
#include <kpluginfactory.h>
|
#include <kpluginfactory.h>
|
||||||
#include <kpluginloader.h>
|
#include <kpluginloader.h>
|
||||||
|
|
||||||
|
#include "config-kgreeter.h"
|
||||||
|
|
||||||
K_PLUGIN_FACTORY(KCMGreeterFactory, registerPlugin<KCMGreeter>();)
|
K_PLUGIN_FACTORY(KCMGreeterFactory, registerPlugin<KCMGreeter>();)
|
||||||
K_EXPORT_PLUGIN(KCMGreeterFactory("kcmgreeterconfig", "kcm_greeterconfig"))
|
K_EXPORT_PLUGIN(KCMGreeterFactory("kcmgreeterconfig", "kcm_greeterconfig"))
|
||||||
|
|
||||||
|
@ -49,9 +53,11 @@ KCMGreeter::KCMGreeter(QWidget* parent, const QVariantList& args)
|
||||||
about->addAuthor(ki18n("Ivailo Monev"), KLocalizedString(), "xakepa10@gmail.com");
|
about->addAuthor(ki18n("Ivailo Monev"), KLocalizedString(), "xakepa10@gmail.com");
|
||||||
setAboutData(about);
|
setAboutData(about);
|
||||||
|
|
||||||
layout()->setContentsMargins(0, 0, 0, 0);
|
|
||||||
|
|
||||||
load();
|
load();
|
||||||
|
|
||||||
|
m_lightdmexe = KStandardDirs::findRootExe("lightdm");
|
||||||
|
testbutton->setEnabled(!m_lightdmexe.isEmpty());
|
||||||
|
connect(testbutton, SIGNAL(pressed()), this, SLOT(slotTest()));
|
||||||
}
|
}
|
||||||
|
|
||||||
KCMGreeter::~KCMGreeter()
|
KCMGreeter::~KCMGreeter()
|
||||||
|
@ -60,6 +66,12 @@ KCMGreeter::~KCMGreeter()
|
||||||
|
|
||||||
void KCMGreeter::load()
|
void KCMGreeter::load()
|
||||||
{
|
{
|
||||||
|
QSettings kgreetersettings(SYSCONF_INSTALL_DIR "/lightdm/lightdm-kgreeter-greeter.conf", QSettings::IniFormat);
|
||||||
|
qDebug() << Q_FUNC_INFO << kgreetersettings.value("greeter/style").toString();
|
||||||
|
qDebug() << Q_FUNC_INFO << kgreetersettings.value("greeter/colorscheme").toString();
|
||||||
|
qDebug() << Q_FUNC_INFO << kgreetersettings.value("greeter/background").toString();
|
||||||
|
qDebug() << Q_FUNC_INFO << kgreetersettings.value("greeter/rectangle").toString();
|
||||||
|
|
||||||
emit changed(false);
|
emit changed(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,4 +80,11 @@ void KCMGreeter::save()
|
||||||
emit changed(false);
|
emit changed(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KCMGreeter::slotTest()
|
||||||
|
{
|
||||||
|
if (!QProcess::startDetached(m_lightdmexe, QStringList() << QString::fromLatin1("--test-mode"))) {
|
||||||
|
KMessageBox::error(this, i18n("Could not start LightDM"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#include "moc_kgreeterconfig.cpp"
|
#include "moc_kgreeterconfig.cpp"
|
||||||
|
|
|
@ -31,13 +31,19 @@
|
||||||
class KCMGreeter : public KCModule, public Ui_KGreeterDialog
|
class KCMGreeter : public KCModule, public Ui_KGreeterDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
// KCModule reimplementations
|
||||||
KCMGreeter(QWidget* parent, const QVariantList&);
|
KCMGreeter(QWidget* parent, const QVariantList&);
|
||||||
~KCMGreeter();
|
~KCMGreeter();
|
||||||
|
|
||||||
virtual void load();
|
void load() final;
|
||||||
virtual void save();
|
void save() final;
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void slotTest();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString m_lightdmexe;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KGREETERCONFIG_H
|
#endif // KGREETERCONFIG_H
|
||||||
|
|
|
@ -6,12 +6,122 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>481</width>
|
<width>496</width>
|
||||||
<height>466</height>
|
<height>253</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout"/>
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="6" column="1">
|
||||||
|
<widget class="QPushButton" name="testbutton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Test</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="0">
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="2">
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0" colspan="3">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Color scheme:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Style:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QComboBox" name="colorbox"/>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Background:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="KUrlRequester" name="backgroundquester"/>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QComboBox" name="stylescombo"/>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>Rectangle:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1">
|
||||||
|
<widget class="KUrlRequester" name="rectanglerequester"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0" colspan="3">
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>KUrlRequester</class>
|
||||||
|
<extends></extends>
|
||||||
|
<header>kurlrequester.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
Loading…
Add table
Reference in a new issue