aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop/BootSplash.cpp
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2016-12-13 11:44:35 -0500
committerKen Moore <ken@ixsystems.com>2016-12-13 11:44:35 -0500
commitd3cec7b2198761622f444dc5a18db2cc2c7fecfa (patch)
treebfc57151e1c5e1af9ac1031e2350ec47b585cd6c /src-qt5/core/lumina-desktop/BootSplash.cpp
parentAdd the new xinput dependency into the port for FreeBSD. (diff)
downloadlumina-d3cec7b2198761622f444dc5a18db2cc2c7fecfa.tar.gz
lumina-d3cec7b2198761622f444dc5a18db2cc2c7fecfa.tar.bz2
lumina-d3cec7b2198761622f444dc5a18db2cc2c7fecfa.zip
Add new options for the Lumina tips:
If a lumina-motd file (executable or text) is found within one of the etc directories (/usr/local/etc/lumina-motd on FreeBSD) or as a valid binary on PATH, then that file will be "preferred" for generating the tips rather than the built-in system. This allows system administrators and/or OS-distributors to customize the login messages "at will" for their particular use-case. NOTE: By making the lumina-motd file a blank text file the tips will be disabled.
Diffstat (limited to 'src-qt5/core/lumina-desktop/BootSplash.cpp')
-rw-r--r--src-qt5/core/lumina-desktop/BootSplash.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/src-qt5/core/lumina-desktop/BootSplash.cpp b/src-qt5/core/lumina-desktop/BootSplash.cpp
index 8903d963..1a648973 100644
--- a/src-qt5/core/lumina-desktop/BootSplash.cpp
+++ b/src-qt5/core/lumina-desktop/BootSplash.cpp
@@ -16,8 +16,24 @@ BootSplash::BootSplash() : QWidget(0, Qt::SplashScreen | Qt::X11BypassWindowMana
}
void BootSplash::generateTipOfTheDay(){
- int index = qrand()%46; //Make sure this number matches the length of the case below (max value +1)
+ //Try to find a system-defined message of the day for lumina
+ QStringList dirs; dirs << LOS::AppPrefix()+"/etc/" << LOS::SysPrefix()+"/etc/" << L_ETCDIR+"/";
+ QString sysMOTD = "lumina-motd";
+ for(int i=0; i<dirs.length(); i++){
+ if(QFile::exists(dirs[i]+sysMOTD)){ sysMOTD.prepend(dirs[i]); break; }
+ }
+
QString tip;
+ if(sysMOTD.contains("/") && LUtils::isValidBinary(sysMOTD)){
+ //is binary - run it to generate text
+ tip = LUtils::getCmdOutput(sysMOTD).join("\n");
+
+ }else if(QFile::exists(sysMOTD)){
+ //text file - read it to generate text
+ tip = LUtils::readFile(sysMOTD).join("\n");
+
+ }else{
+ int index = qrand()%46; //Make sure this number matches the length of the case below (max value +1)
switch(index){
case 0:
tip = tr("This desktop is powered by coffee, coffee, and more coffee."); break;
@@ -111,7 +127,9 @@ void BootSplash::generateTipOfTheDay(){
tip = "\""+tr("The truth is more important than the facts.")+"\"\n\n- Frank Lloyd Wright -"; break;
case 45:
tip = "\""+tr("Better to remain silent and be thought a fool than to speak out and remove all doubt.")+"\"\n\n- Abraham Lincoln -"; break;
- }
+ } //end of switch for tips
+
+ } //end of fallback tip generation
ui->label_welcome->setText( tip);
}
bgstack15