[PC-BSD Commits] r21594 - in pcbsd-projects/PCDM: . images

svn at pcbsd.org svn at pcbsd.org
Wed Feb 20 10:54:58 PST 2013


Author: kenmoore
Date: 2013-02-20 18:54:58 +0000 (Wed, 20 Feb 2013)
New Revision: 21594

Modified:
   pcbsd-projects/PCDM/images/banner.png
   pcbsd-projects/PCDM/pcdm-gui.cpp
   pcbsd-projects/PCDM/pcdm-gui.h
   pcbsd-projects/PCDM/pcdm.theme
Log:
Enable the ability for PCDM to now save/load last login info and set the interface to that info appropriately on startup.



Modified: pcbsd-projects/PCDM/images/banner.png
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/pcdm-gui.cpp
===================================================================
--- pcbsd-projects/PCDM/pcdm-gui.cpp	2013-02-20 18:54:55 UTC (rev 21593)
+++ pcbsd-projects/PCDM/pcdm-gui.cpp	2013-02-20 18:54:58 UTC (rev 21594)
@@ -40,6 +40,8 @@
       currentTheme->importItem( invalid[i] , defaultTheme->exportItem(invalid[i]) );
     }
   }
+  //Load the data from the last successful login
+  loadLastLogin();
   
 }
 
@@ -147,7 +149,7 @@
     //Username/Password/Login widget
     loginW = new LoginWidget;
     loginW->setUsernames(Backend::getSystemUsers()); //add in the detected users
-    //loginW->setCurrentUser(); //set the previously used user
+    if(!lastUser.isEmpty()){ loginW->setCurrentUser(lastUser); } //set the previously used user
     //Set Icons from theme
     tmpIcon = currentTheme->itemIcon("login");
     if(!QFile::exists(tmpIcon) || tmpIcon.isEmpty() ){ tmpIcon=":/images/next.png"; }
@@ -223,6 +225,7 @@
     emit xCmdFound(binary);
     emit xHomeFound( Backend::getUserHomeDir(username) );
     emit xSessionStart(); //start the desktop environment
+    saveLastLogin( displayname, deSwitcher->currentItem() );
     slotClosePCDM(); //now start to close down the PCDM GUI
   }else{
     //Display an info box that the login failed
@@ -382,7 +385,37 @@
     deSwitcher->addItem( deList[i], deIcon, Backend::getDesktopComment(deList[i]) );
   }
     //Set the switcher to the last used desktop environment
-    //deSwitcher->setCurrentItem("kde3");
+    if( !lastDE.isEmpty() ){ deSwitcher->setCurrentItem(lastDE); }
 
 }
 
+void PCDMgui::loadLastLogin(){
+  lastUser.clear();
+  lastDE.clear();
+  if(!QFile::exists("/usr/local/share/PCDM/.lastlogin")){
+    Backend::log("PCDM: No previous login data found");
+  }else{
+    //Load the previous login data
+    QFile file("/usr/local/share/PCDM/.lastlogin");
+    if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){
+      Backend::log("PCDM: Unable to open previous login data file");    
+    }else{
+      QTextStream in(&file);
+      lastUser= in.readLine();
+      lastDE= in.readLine();
+      file.close();
+    }
+  }
+}
+
+void PCDMgui::saveLastLogin(QString USER, QString DE){
+  QFile file("/usr/local/share/PCDM/.lastlogin");
+  if(!file.open(QIODevice::Truncate | QIODevice::WriteOnly | QIODevice::Text)){
+    Backend::log("PCDM: Unable to save last login data");	  
+  }else{
+    QTextStream out(&file);
+    out << USER << "/n" << DE;
+    file.close();
+  }
+}
+

Modified: pcbsd-projects/PCDM/pcdm-gui.h
===================================================================
--- pcbsd-projects/PCDM/pcdm-gui.h	2013-02-20 18:54:55 UTC (rev 21593)
+++ pcbsd-projects/PCDM/pcdm-gui.h	2013-02-20 18:54:58 UTC (rev 21594)
@@ -63,11 +63,13 @@
     ThemeStruct* currentTheme;
 
     QTranslator* m_translator;
-    QString translationDir;
+    QString translationDir, lastUser, lastDE;
     //Functions
     void createGUIfromTheme();
     void retranslateUi();
     void loadTheme();
+    void loadLastLogin();
+    void saveLastLogin(QString, QString);
 
 signals:
     void xUserFound(QString);

Modified: pcbsd-projects/PCDM/pcdm.theme
===================================================================
--- pcbsd-projects/PCDM/pcdm.theme	2013-02-20 18:54:55 UTC (rev 21593)
+++ pcbsd-projects/PCDM/pcdm.theme	2013-02-20 18:54:58 UTC (rev 21594)
@@ -16,7 +16,7 @@
   BACKGROUND_DISABLE=FALSE		# Flag to disable using a background image
 
 HEADER_IMAGE=default-header.jpg 	# Image to be displayed as a window header
-  HEADER_IMAGE_SIZE=600x200		# Size for the image (in pixels)
+  HEADER_IMAGE_SIZE=800x200		# Size for the image (in pixels)
   HEADER_DISABLE=FALSE			# Flag to remove the header image entirely
   
 USER_IMAGE=default-user.png  		# Image for the user selection widget
@@ -94,12 +94,13 @@
 	border-radius: 5px;
 }
 QGraphicsView{ 
-	background: rgba(255,255,255,180); 
+	background: rgba(253,253,253,180); 
 	color: black; 
 	border: 1px solid grey; 
 	border-radius: 5px; 
 }
 QPushButton{ background-color: transparent; border: none; }
 QPushButton:hover{ background-color: transparent; border: 1px solid grey; border-radius: 5px; }
+QMessageBox{}
 
 APP_STYLESHEET_STOP



More information about the Commits mailing list