[PC-BSD Commits] r22061 - in pcbsd-projects/PCDM: . themes/default

svn at pcbsd.org svn at pcbsd.org
Thu Apr 4 08:15:29 PDT 2013


Author: kenmoore
Date: 2013-04-04 15:15:29 +0000 (Thu, 04 Apr 2013)
New Revision: 22061

Modified:
   pcbsd-projects/PCDM/loginWidget.cpp
   pcbsd-projects/PCDM/loginWidget.h
   pcbsd-projects/PCDM/pcdm-config.cpp
   pcbsd-projects/PCDM/pcdm-config.h
   pcbsd-projects/PCDM/pcdm-gui.cpp
   pcbsd-projects/PCDM/pcdm.conf
   pcbsd-projects/PCDM/themeStruct.cpp
   pcbsd-projects/PCDM/themes/default/default.theme
Log:
Add a couple new options for PCDM:
1) Ability to enable/disable the password view button in pcdm.conf
2) Ability to use "./" in the theme file to refer to the current directory
The configuration files have been adjusted to reflect these options



Modified: pcbsd-projects/PCDM/loginWidget.cpp
===================================================================
--- pcbsd-projects/PCDM/loginWidget.cpp	2013-04-04 09:32:52 UTC (rev 22060)
+++ pcbsd-projects/PCDM/loginWidget.cpp	2013-04-04 15:15:29 UTC (rev 22061)
@@ -63,11 +63,10 @@
   connect(pushLogin,SIGNAL(clicked()),this,SLOT(slotTryLogin()));
   connect(pushUserIcon,SIGNAL(triggered(QAction*)), this, SLOT(slotUserActivated(QAction*)));
   connect(userIcon,SIGNAL(triggered(QAction*)), this, SLOT(slotUserActivated(QAction*)));
-  connect(pushViewPassword,SIGNAL(pressed()),this,SLOT(slotChangePWView()));
-  connect(pushViewPassword,SIGNAL(released()),this,SLOT(slotChangePWView()));
   connect(listUsers,SIGNAL(activated(int)),this,SLOT(slotChooseUser(int)));
   connect(listUserBig,SIGNAL(itemClicked(QListWidgetItem*)),this,SLOT(slotUserClicked(QListWidgetItem*)) );
   connect(listUserBig,SIGNAL(currentRowChanged(int)),this,SLOT(slotUserHighlighted(int)) );
+  allowPasswordView(TRUE); //setup signal/slots for pushViewPassword
   //Set this layout for the loginWidget
   this->setLayout(vlayout);
   
@@ -298,3 +297,12 @@
     listUserBig->setFocus();
   }
 }
+
+void LoginWidget::allowPasswordView(bool allow){
+  //Enable/disable the password view button as desired
+  pushViewPassword->disconnect(); //disconnect the signal/slot (keep nice appearance)
+  if(allow){
+    connect(pushViewPassword,SIGNAL(pressed()),this,SLOT(slotChangePWView()));
+    connect(pushViewPassword,SIGNAL(released()),this,SLOT(slotChangePWView()));    
+  }
+}

Modified: pcbsd-projects/PCDM/loginWidget.h
===================================================================
--- pcbsd-projects/PCDM/loginWidget.h	2013-04-04 09:32:52 UTC (rev 22060)
+++ pcbsd-projects/PCDM/loginWidget.h	2013-04-04 15:15:29 UTC (rev 22061)
@@ -49,6 +49,7 @@
         void keyPressEvent(QKeyEvent *e);
         void retranslateUi();
         void resetFocus(QString item="");
+        void allowPasswordView(bool);
   
   private:
   	QComboBox* listUsers;

Modified: pcbsd-projects/PCDM/pcdm-config.cpp
===================================================================
--- pcbsd-projects/PCDM/pcdm-config.cpp	2013-04-04 09:32:52 UTC (rev 22060)
+++ pcbsd-projects/PCDM/pcdm-config.cpp	2013-04-04 15:15:29 UTC (rev 22061)
@@ -22,6 +22,7 @@
   confStruct << "no-desktop";				// [5] Auto-login desktop environment
   confStruct << "no-password";				// [6] Auto-login password
   confStruct << "/usr/local/share/PCDM/images/default-splash.png"; // [7] Splash Screen File
+  confStruct << "TRUE";					// [8] Password view button enabled
   return;
 }
 
@@ -51,6 +52,7 @@
       else if(var=="AUTO_LOGIN_DESKTOP"){ confStruct[5] = val; }
       else if(var=="AUTO_LOGIN_PASSWORD"){ confStruct[6] = val; }
       else if(var=="SPLASHSCREEN_FILE"){ confStruct[7] = val; }
+      else if(var=="ENABLE_VIEW_PASSWORD_BUTTON"){ confStruct[8] = val; }
       else{}
       
     }
@@ -102,3 +104,9 @@
 QString Config::splashscreen(){
   return confStruct[7];	
 }
+
+bool Config::allowPasswordView(){
+  if(confStruct[8].toLower()=="true"){ return TRUE; }
+  else{ return FALSE; }	
+}
+

Modified: pcbsd-projects/PCDM/pcdm-config.h
===================================================================
--- pcbsd-projects/PCDM/pcdm-config.h	2013-04-04 09:32:52 UTC (rev 22060)
+++ pcbsd-projects/PCDM/pcdm-config.h	2013-04-04 15:15:29 UTC (rev 22061)
@@ -31,6 +31,7 @@
   static QString autoLoginDesktop();	//return *.desktop file to startup automatically
   static QString autoLoginPassword();	//returns password to log in automatically
   static QString splashscreen();	//return the image file for the splashscreen
+  static bool allowPasswordView();	//returns whether password view button is enabled
 
 };
 

Modified: pcbsd-projects/PCDM/pcdm-gui.cpp
===================================================================
--- pcbsd-projects/PCDM/pcdm-gui.cpp	2013-04-04 09:32:52 UTC (rev 22060)
+++ pcbsd-projects/PCDM/pcdm-gui.cpp	2013-04-04 15:15:29 UTC (rev 22061)
@@ -173,6 +173,8 @@
     //Display the Hostname
     QString hostname = QProcessEnvironment::systemEnvironment().value("HOST");
     loginW->displayHostName(hostname);
+    //Enable/disable the password view functionality
+    loginW->allowPasswordView( Config::allowPasswordView() );
     //Add item to the grid
     grid->addWidget( loginW, currentTheme->itemLocation("login","row"), \
                       currentTheme->itemLocation("login","col"), \

Modified: pcbsd-projects/PCDM/pcdm.conf
===================================================================
--- pcbsd-projects/PCDM/pcdm.conf	2013-04-04 09:32:52 UTC (rev 22060)
+++ pcbsd-projects/PCDM/pcdm.conf	2013-04-04 15:15:29 UTC (rev 22061)
@@ -15,8 +15,13 @@
 ## This presents a security risk - use carefully! ##
 ENABLE_AUTO_LOGIN=FALSE         
 AUTO_LOGIN_USER=no-username
+AUTO_LOGIN_PASSWORD=no-password
 AUTO_LOGIN_DESKTOP=nothing.desktop   # *.desktop file (absolute path or relative to DE_STARTUP_DIR)
 
 ## XDMCP SUPPORT ##
 ## This presents a security risk - use carefully! ##
 ALLOW_REMOTE_LOGIN=FALSE
+
+## ADDITIONAL SETTINGS ##
+ENABLE_VIEW_PASSWORD_BUTTON=TRUE  #enable the option to show the password as text when a button is held
+

Modified: pcbsd-projects/PCDM/themeStruct.cpp
===================================================================
--- pcbsd-projects/PCDM/themeStruct.cpp	2013-04-04 09:32:52 UTC (rev 22060)
+++ pcbsd-projects/PCDM/themeStruct.cpp	2013-04-04 15:15:29 UTC (rev 22061)
@@ -17,7 +17,13 @@
     ThemeItem it; 
     items << it; 
   }
-  
+  //Get the directory the current theme file is in
+  int li = filePath.lastIndexOf("/");
+  QString currDir = filePath;
+  if(li > 0){ currDir.truncate(li); } //should keep the "/" on the end
+  else{ currDir.clear(); }
+  qDebug() << "currDir" << currDir << "li" << li << "filePath" << filePath;
+  //Now initialize variables for the file search
   QString iconFileDir;
   int numspacers = 0;
   
@@ -52,6 +58,7 @@
       if(prop == "IMAGE_DIR" && !val.isEmpty()){ //default directory for icons
 	if(!val.endsWith("/")){val.append("/");}
 	iconFileDir = val; 
+        if(iconFileDir.startsWith("./")){ iconFileDir.replace(0,2,currDir); }
       }else if( prop == "ADDSPACER" ){ //create a spacer item
 	itemNames << "spacer"+QString::number(numspacers);
 	numspacers++;

Modified: pcbsd-projects/PCDM/themes/default/default.theme
===================================================================
--- pcbsd-projects/PCDM/themes/default/default.theme	2013-04-04 09:32:52 UTC (rev 22060)
+++ pcbsd-projects/PCDM/themes/default/default.theme	2013-04-04 15:15:29 UTC (rev 22061)
@@ -9,7 +9,7 @@
 ##########################
 
 ## Base directory for images (if absolute path not explicitly declared) ##
-IMAGE_DIR=/usr/local/share/PCDM/themes/default/  #location of all/most image files for this theme
+IMAGE_DIR=./  #location of all/most image files for this theme ("./" = current directory)
 
 #### Images (relative to IMAGE_DIR) ####
 BACKGROUND_IMAGE=background.jpg  	# will stretch to fill the screen



More information about the Commits mailing list