Commit a99b0eb7 authored by Marco Martin's avatar Marco Martin

select theme from command line in testing mode

this enables a --theme option in order to test
different lockers.
for precaution only when ---testing is passed as well

REVIEW:127168
parent a6756057
......@@ -138,9 +138,9 @@ void UnlockApp::initialize()
KScreenSaverSettings::self()->load();
KPackage::Package package = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/LookAndFeel"));
KConfigGroup cg(KSharedConfig::openConfig(QStringLiteral("kdeglobals")), "KDE");
const QString packageName = cg.readEntry("LookAndFeelPackage", QString());
if (!packageName.isEmpty()) {
package.setPath(packageName);
m_packageName = cg.readEntry("LookAndFeelPackage", QString());
if (!m_packageName.isEmpty()) {
package.setPath(m_packageName);
}
if (!KScreenSaverSettings::theme().isEmpty()) {
package.setPath(KScreenSaverSettings::theme());
......@@ -415,6 +415,19 @@ void UnlockApp::setTesting(bool enable)
}
}
void UnlockApp::setTheme(const QString &theme)
{
if (theme.isEmpty() || !m_testing) {
return;
}
m_packageName = theme;
KPackage::Package package = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/LookAndFeel"));
package.setPath(m_packageName);
m_mainQmlPath = QUrl::fromLocalFile(package.filePath("lockscreenmainscript"));
}
void UnlockApp::setImmediateLock(bool immediate)
{
m_immediateLock = immediate;
......
......@@ -53,6 +53,7 @@ public:
virtual ~UnlockApp();
void setTesting(bool enable);
void setTheme(const QString &theme);
void setImmediateLock(bool immediateLock);
void lockImmediately();
void setGraceTime(int milliseconds);
......@@ -83,6 +84,7 @@ private:
void initializeWayland();
void shareEvent(QEvent *e, KQuickAddons::QuickViewSharedEngine *from);
QString m_packageName;
QUrl m_mainQmlPath;
QList<KQuickAddons::QuickViewSharedEngine*> m_views;
QTimer *m_resetRequestIgnoreTimer;
......
......@@ -88,6 +88,12 @@ int main(int argc, char* argv[])
QCommandLineOption testingOption(QStringLiteral("testing"),
i18n("Starts the greeter in testing mode"));
QCommandLineOption themeOption(QStringLiteral("theme"),
i18n("Starts the greeter with the selected theme (only in Testing mode)"),
QStringLiteral("theme"),
QStringLiteral(""));
QCommandLineOption immediateLockOption(QStringLiteral("immediateLock"),
i18n("Lock immediately, ignoring any grace time etc."));
QCommandLineOption graceTimeOption(QStringLiteral("graceTime"),
......@@ -101,6 +107,7 @@ int main(int argc, char* argv[])
QStringLiteral("fd"));
parser.addOption(testingOption);
parser.addOption(themeOption);
parser.addOption(immediateLockOption);
parser.addOption(graceTimeOption);
parser.addOption(nolockOption);
......@@ -111,6 +118,12 @@ int main(int argc, char* argv[])
app.setTesting(true);
app.setImmediateLock(true);
//parse theme option
const QString theme = parser.value(themeOption);
if (!theme.isEmpty()) {
app.setTheme(theme);
}
// allow ptrace if testing is enabled
#if HAVE_PR_SET_DUMPABLE
prctl(PR_SET_DUMPABLE, 1);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment