mirror of
https://bitbucket.org/smil3y/kde-playground.git
synced 2025-02-23 18:32: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
|
||||
)
|
||||
|
||||
add_subdirectory(kcm)
|
||||
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/config-kgreeter.h.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/config-kgreeter.h
|
||||
@ONLY
|
||||
)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
add_subdirectory(kcm)
|
||||
|
||||
include_directories(
|
||||
${KATIE_INCLUDES}
|
||||
${KDE4_INCLUDES}
|
||||
|
|
|
@ -18,14 +18,18 @@
|
|||
|
||||
#include "kgreeterconfig.h"
|
||||
|
||||
#include <QSettings>
|
||||
#include <QProcess>
|
||||
#include <kdebug.h>
|
||||
#include <klocale.h>
|
||||
#include <kstandarddirs.h>
|
||||
#include <kmessagebox.h>
|
||||
#include <kaboutdata.h>
|
||||
#include <kconfig.h>
|
||||
#include <kconfiggroup.h>
|
||||
#include <kpluginfactory.h>
|
||||
#include <kpluginloader.h>
|
||||
|
||||
#include "config-kgreeter.h"
|
||||
|
||||
K_PLUGIN_FACTORY(KCMGreeterFactory, registerPlugin<KCMGreeter>();)
|
||||
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");
|
||||
setAboutData(about);
|
||||
|
||||
layout()->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
load();
|
||||
|
||||
m_lightdmexe = KStandardDirs::findRootExe("lightdm");
|
||||
testbutton->setEnabled(!m_lightdmexe.isEmpty());
|
||||
connect(testbutton, SIGNAL(pressed()), this, SLOT(slotTest()));
|
||||
}
|
||||
|
||||
KCMGreeter::~KCMGreeter()
|
||||
|
@ -60,6 +66,12 @@ KCMGreeter::~KCMGreeter()
|
|||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -68,4 +80,11 @@ void KCMGreeter::save()
|
|||
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"
|
||||
|
|
|
@ -31,13 +31,19 @@
|
|||
class KCMGreeter : public KCModule, public Ui_KGreeterDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
// KCModule reimplementations
|
||||
KCMGreeter(QWidget* parent, const QVariantList&);
|
||||
~KCMGreeter();
|
||||
|
||||
virtual void load();
|
||||
virtual void save();
|
||||
void load() final;
|
||||
void save() final;
|
||||
|
||||
private Q_SLOTS:
|
||||
void slotTest();
|
||||
|
||||
private:
|
||||
QString m_lightdmexe;
|
||||
};
|
||||
|
||||
#endif // KGREETERCONFIG_H
|
||||
|
|
|
@ -6,12 +6,122 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>481</width>
|
||||
<height>466</height>
|
||||
<width>496</width>
|
||||
<height>253</height>
|
||||
</rect>
|
||||
</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>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>KUrlRequester</class>
|
||||
<extends></extends>
|
||||
<header>kurlrequester.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
Loading…
Add table
Reference in a new issue